Was going so nice this morning, but now I'm all stuffy, and I've just "discovered" that charming lack of a type system in C. I was changing types around in parameters, trying to find out some information about the code I was looking at, but silly me, anything can convert to and from void*. Awesome.
Page Summary
Style Credit
- Style: Neutral Good for Practicality by
Expand Cut Tags
No cut tags
no subject
Date: 2007-01-09 03:53 pm (UTC)no subject
Date: 2007-01-09 03:59 pm (UTC)no subject
Date: 2007-01-09 04:02 pm (UTC)no subject
Date: 2007-01-09 04:11 pm (UTC)While I don't nearly think that C++ is the end-all, be-all of computer languages, I definitely disagree with
no subject
Date: 2007-01-09 04:23 pm (UTC)I also prefer C for anything embedded, where code and data space are tight and you need fine control of what is and is not compiled into PROM. (there are proposed C++ mechanisms to help in this regard, but they don't exist yet.)
On the other hand, C++ does have a number of features I wish C had.
no subject
Date: 2007-01-09 04:30 pm (UTC)By "what is compiled into PROM", you mean what goes in the text segment? C++ offers just as good controls on that as C, I find, but it is true that initialization of global variables can be less efficient in C++ (usually when a constructor gets involved, but there's a few other ticklish details)...
At the worst case, I'd say that a very tight embedded context might be one where, yes, in the end, you might have to skip on C++.
But I'm on big-iron cluster hardware here, for goodness' sakes!
no subject
Date: 2007-01-09 04:43 pm (UTC)As for the PROM comment, very often in embedded systems the RAM is at a premium, so you need to have as much of your static data constructed at compile time and loaded into a read-only segment that can be in PROM.
Its very hard to make static structured data in C++ that doesn't need to be initialized at runtime.
no subject
Date: 2007-01-09 04:27 pm (UTC)no subject
Date: 2007-01-09 04:31 pm (UTC)no subject
Date: 2007-01-11 06:14 pm (UTC)no subject
Date: 2007-01-09 04:38 pm (UTC)I think that's my cue to post nekkid women...
no subject
Date: 2007-01-09 04:43 pm (UTC)I aim to please...
Date: 2007-01-09 04:57 pm (UTC)Re: I aim to please...
Date: 2007-01-09 08:49 pm (UTC)no subject
Date: 2007-01-09 05:15 pm (UTC)It would be nice if the escape hatch returned an opaque address with a runtime type descriptor, and the only way "back inside" the type system involved a runtime check; but it'd also be nice if the type system just had type variables in the first place. This was an intentionally minimalist language, relative to its contemporaries.
no subject
Date: 2007-01-09 09:02 pm (UTC)Not asking for runtime type system, reflection or anything fancy like that. Foo* doesn't cast automatically into Bar*, and void is no different than Bar or Foo. That's not asking for the moon, isn't it? Couldn't they figure that out back then? No, they had to have a magic type and screw me over more than thirty years later!
no subject
Date: 2007-01-10 03:06 pm (UTC)However, you can take advantage of the fact that C++ is so similar to C. Simply use the C++ compiler to compile your C programs. I've used this technique several times in past lives to track down bugs that standard C didn't want to tell me about. Beware, though, that you might find yourself discovering a lot of *other* bugs you didn't really want to fix. :)
You can use any subset of C++ you want. This technique is just using a very, very, very strict subset.
--apenwarr
no subject
Date: 2007-01-10 03:12 pm (UTC)*stab*