Closed Bug 504233 Opened 10 years ago Closed 10 years ago

Add SIZE_MAX, etc. #defines to jsinttypes.h

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: Waldo, Assigned: Waldo)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

For greater styling as though we were using C99's definitions directly...
Attached patch Patch (obsolete) — Splinter Review
It's not strictly to spec as the comments in the changes note, but it's enough for us.  No rush on review, just general incremental code hygiene improvement...
Attachment #388816 - Flags: review?(jim)
Comment on attachment 388816 [details] [diff] [review]
Patch

Could we have static asserts for the ptrdiff limits, too?

I think jsnum.cpp is as good a place as any for the static asserts.
Comment on attachment 388816 [details] [diff] [review]
Patch

This looks great --- but I would like to have static asserts for the pointer-sized types, and I'd like to have all the limit definitions protected as they are in <stdint.h>, to give "jsstdint.h" as similar an interface to the standard as possible.
Attachment #388816 - Flags: review?(jim) → review-
Attached patch v2Splinter Review
On my system stdlib.h includes stdint.h, so the define has to be way way early.  Given that, I gave up on just putting a universal define in jsprvtd.h; we'll have to suck it up and add it to files as needed.
Attachment #388816 - Attachment is obsolete: true
Attachment #399845 - Flags: review?
We used to have a "jsstddef.h" include that by design had to come first (for some Windows 3.1 brain damage, I will drink if I have to remember it all -- had to do with ptrdiff_t being int16 and incapable of expressing distance between array elements on Win16!). Maybe we should bring it back.

"jstypes.h" is first among the local includes but after standard header file includes alas.

Just thinking about how you could get this macro "for free".

/be
Attachment #399845 - Flags: review? → review+
http://hg.mozilla.org/mozilla-central/rev/3b61bf6ab635
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.