|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Use of 'bool' in SpiderMonkey codeIf we're migrating towards bool/true/false over JSBool/JS_TRUE/JS_FALSE,
what's our policy towards SpiderMonkey headers #included into C code? Should they continue to use JSBool? #include <stdbool.h>, even though that introduces a definition for 'bool' into client code? C99 has a _Bool built-in type, which allows new headers to use the type without introducing definitions for 'bool' into old code, because _Bool isn't defined in C++; defining it ourselves seems like asking for more trouble. My personal preference would be to simply #include <stdbool.h> in jstypes.h if !defined(__cplusplus), use bool freely, and have users cope. We have to leave the old stuff behind eventually. I'll update the style guides at: https://wiki.mozilla.org/JavaScript:SpiderMonkey:C%2B%2B_Coding_Style https://wiki.mozilla.org/JavaScript:SpiderMonkey:C_Coding_Style to reflect the conclusions. _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
Re: Use of 'bool' in SpiderMonkey codeOn 10/28/2009 12:51 PM, Jim Blandy wrote:
> If we're migrating towards bool/true/false over JSBool/JS_TRUE/JS_FALSE, > what's our policy towards SpiderMonkey headers #included into C code? > Should they continue to use JSBool? #include <stdbool.h>, even though > that introduces a definition for 'bool' into client code? Just to be clear: deleting JS_TRUE/JS_FALSE/JSBool from the API has never been on the table. Client code can continue to use those. Rather, I'd gotten comments on patches asking me to use the bool stuff instead of the JSBool stuff. For things visible only within SM, that's fine. But I want to understand the boundary cases --- specifically, what happens to the types in the public API, and semi-public APIs like jsdbgapi.h? _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
Re: Use of 'bool' in SpiderMonkey codeOn 10/28/2009 04:54 PM, Jim Blandy wrote:
> On 10/28/2009 12:51 PM, Jim Blandy wrote: >> If we're migrating towards bool/true/false over JSBool/JS_TRUE/JS_FALSE, >> what's our policy towards SpiderMonkey headers #included into C code? >> Should they continue to use JSBool? #include <stdbool.h>, even though >> that introduces a definition for 'bool' into client code? > > Just to be clear: deleting JS_TRUE/JS_FALSE/JSBool from the API has > never been on the table. Client code can continue to use those. > > Rather, I'd gotten comments on patches asking me to use the bool stuff > instead of the JSBool stuff. For things visible only within SM, that's > fine. But I want to understand the boundary cases --- specifically, what > happens to the types in the public API, and semi-public APIs like > jsdbgapi.h? My understanding was that the public and existing "friend" APIs won't change, and new APIs in header files included from C (public and semi-public) should continue to use JSBool. In SM's own .cpp files, JS_TRUE and JS_FALSE basically shouldn't be used anymore. -j _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
| Free embeddable forum powered by Nabble | Forum Help |