Gcc already contains useful warnings for almost certainly incorrect code. I
propose adding a warning when pointer arithmetic is used inside sizeof, that
degrades an array to a pointer.


char a[]="blabla";
sizeof(a-1);

If the intention was _actually_ to get sizeof(char), it is a really awful way
to do so. Instead, it is very likely a typo.
Hence i suggest adding a warning.
thanks.


-- 
           Summary: warn about pointer aritmetic in sizeof
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aep at exys dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43789

Reply via email to