5 ms·
Perhaps the compiler wasn't relied upon to provide "short circuit" boolean eval? This code will compile that way no matter if it's available in the compiler or
by OldSchool 13y ago
Perhaps the compiler wasn't relied upon to provide "short circuit" boolean eval? This code will compile that way no matter if it's available in the compiler or not.
Honestly for the sake of being more robust, I'd add if(a != nil) after the first test of b.
if(b != nil)
if(a != nil)
if ...
- SoftwareMaven 13y agoIf the compiler can't do short-circuit evaluation, the compiler can't do C compilation.
- glurgh 13y agoShort circuit is guaranteed by the language standard. On top of that, plan9 comes with its own C compiler so the people who wrote this also wrote the compiler used to compile it.
- OldSchool 13y agoI see, I just have no idea how complete the Plan 9 tools are. Working with in-house domain specific language interpreters or compilers I've twice seen unary minus support missing so I assumed anything was possible when something's not fully commercialized.
- glurgh 13y agoThis popped up in some other thread recently. It was (still is, I suppose) a standard ANSI C89 compiler with a couple of small extensions and tweaks. Ken Thompson's short overview is here - http://plan9.bell-labs.com/sys/doc/compiler.html http://plan9.bell-labs.com/sys/doc/compiler.html You can nerdmuse yourself a little by googling why it had a #pragma hjdicks
- deleted 13y ago[deleted]