The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
maybe it can run on anything with a C compiler ... as long as it was deliberately written to work on any OS with any CRT implementation, using no system-specific libraries, and making no assumptions about the underlying hardware.
the C spec only specifies minimum sizes for short, int and long. int and short must be at least 16 bits. long must be at least 32 bits.
so what any of those types means in terms of storage and CPU handling (aka performance) depends on the compiler and the target architecture.
No, your assessment that they're making an invalid tradeoff is the assumption. JPL writes real-time code for memory limited systems that cannot fail. Their use case is far different from almost everyone else.
When is the code from? There are times were storage does matter alot more than performance. And in the past for NASA they had some very strict storage requirements. I can see this being a huge discussion at the code review.
Interesting to say the least.
Me no, I never really think about it. I almost always use an int and move on with life.
To err is human to really elephant it up you need a computer
In some cases, their loop variable is an int; in others a short; in others a long.
Modern compilers will promote those loop variables to 32/64 bit depending on target architecture. If you are looking at old code... there were reasons to use integer BOOL for performance and 8 bit bool for smaller code-size many years ago. Optimizing compilers today make most of that pointless.
I am finally getting around to reviewing that json library @code-witch keeps obsessing over. First thing I noticed was the liberal use of bool. But in the end... it does't really matter the compiler should promote some of these.
I expect promotion. The reason I use things like bytes and half words is so they fit better on 8bit. I am expecting a lot out of it in terms optimization on a 32 or 64 bit machine. My code favors 8bit it as a result