Re: enum question.



Ian Collins wrote:
CBFalconer wrote:

.... snip ...

C++ doesn't care how much code it generates. Think about the run
time code needed to do the checking (it can't be done at compile
time, because the values are ints and can be the results of
expressions or function calls).

Sorry, but it is. You can't assign an int to an enum variable
without a cast in C++. There isn't any runtime checking, so you
can assign bollocks values if you go out of your way to do so.

We are talking about C, not C++.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: enum question.
    ... CBFalconer wrote: ... snip ... ... C++ doesn't care how much code it generates. ... because the values are ints and can be the results of ...
    (comp.lang.c)
  • Re: string comparison
    ... >> Right here you run into trouble. ... >> suitably aligned for ints?. ... correct code, not something that happens to work on your chosen platform. ... you simply decided not to care. ...
    (comp.lang.c)
  • Re: Help with awk
    ... alternative approach which would be more efficient if File2 is large ... compared to File1 would be: ... {for (i in ints) ...
    (comp.unix.shell)
  • Re: Is a byte data type really a 32-bit int in the JVM?
    ... 32-bit ints actually allocated underneath? ... I am writing ... Maybe you don't care, but the OP does care, ...
    (comp.lang.java.programmer)
  • Re: bool behavior in Python 3000?
    ... > Do you care to explain what is broken? ... I suppose one either finds coercion of arithmetic operations to int ... it does not bother me that arithmetic with ints and bools ... produces ints. ...
    (comp.lang.python)