Re: Problem with code or gcc?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Artur,

> Shouldn't I get a linker error in those other cases?

Not necessarily.

You won't get a linker error if the actual numeric value can be used "as
is", without referencing the variable it is associated with.  Consider it an
optimization of sorts.

If you really dislike this situation[1], you can use enum for your integer
constants in your struct.

[1] I actually PREFER coding like in your example.  But I know quite a few
C++ software engineers that prefer using enums for constants instead --
they'd claim there are "less surprises".  Both idioms will be supported by
C++ for a very long time.

Sincerely,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux