This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiler warnings while compiling gcc with clangâ





> On May 5, 2015, at 1:00 AM, Renato Golin <renato.golin@linaro.org> wrote:
> 
>> On 5 May 2015 at 05:58, Andrew Pinski <pinskia@gmail.com> wrote:
>> These two are bogus and really clang in GCC's mind.  The main reason
>> is the standard says struct and class are the same thing.
> 
> Apart from the fact that classes are private by default and structs
> are not. They may be similar for layout purposes, and it may be ok to
> interchange them on local re-declarations when the compiler doesn't
> need the type completely defined, but they're not the same thing.

Read the standard again. They are the same. The standard is very clear they are the same. 

> 
> The compiler might be smart and use the protection model that the
> original declaration used (private/public), but what that warning is
> saying is that you have refactored your code to include classes and
> forgot to update all uses, which is a very valid warning. I can't see
> why one would *want* to keep the "struct" keyword. If you're already
> compiling in C++ mode, removing it from variable/argument declarations
> should be valid, and re-declaring incomplete types should be made as
> class.


No the warning is there to try to warn people about microsoft's c++ and nothing else. 

Thanks,
Andrew

> 
> cheers,
> --renato


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]