C++ interop issue due to non-null pointers

Florian Weimer fweimer@redhat.com
Wed Jun 18 07:18:00 GMT 2014


On 06/17/2014 05:00 PM, Jakub Jelinek wrote:

>>> GCC will likely not optimize it away at this point, but having code with
>>> undefined behavior is just asking for future trouble.  Just use "" instead?
>>
>> It's always const and may lack sufficient alignment.  The former isn't a
>> problem in C++ (I think), but the alignment is an issue.
>
> Alignment for what?  You don't specify any alignment to the C qsort,

You're returning a T *, not a void *, and C++ requires that pointers are 
properly aligned even if they aren't dereferenced.

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Gcc mailing list