[cfe-dev] Handling of empty structs in C

Sean McBride sean at rogue-research.com
Tue Nov 5 09:12:38 PST 2013


On Tue, 5 Nov 2013 17:33:37 +0100, Andy Gibbs said:

>Long story short, I'm ok with the fact that C and C++ handle empty structs 
>differently, but I was somewhat challenged by my colleague's complaint that 
>surely the compiler should have given a warning that the structure of 
>'struct test' varies depending on the language it is used from

Whenever you think "why doesn't the compiler warn here?!", create a test case (as you did) and try compiling it with -Weverything, which enables literally all warnings.

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada






More information about the cfe-dev mailing list