Hello.
I am a bit confused regarding clang behavior wrt the support of void* arithmetic and dereferencing extensions.
It looks as if clang is treating differently syntactic constructs that (afaict) should be regarded as semantically equivalent.
Consider the following program fragment:
Hello.
I am a bit confused regarding clang behavior wrt the support of void*
arithmetic and dereferencing extensions.
It looks as if clang is treating differently syntactic constructs that
(afaict) should be regarded as semantically equivalent.
Any arithmetic on void* pointers is (as the clang warning points out) a gcc extension, which should probably be discouraged.
Implementing '&p[8]' or 'p[0]' requires you to de-reference a void* pointer, which is a further extension over just allowing arithmetic on void* pointers.
Chris
Christopher Jefferson wrote:
Hello.
I am a bit confused regarding clang behavior wrt the support of void* arithmetic and dereferencing extensions.
It looks as if clang is treating differently syntactic constructs that (afaict) should be regarded as semantically equivalent.
Any arithmetic on void* pointers is (as the clang warning points out) a gcc extension, which should probably be discouraged.
Implementing '&p[8]' or 'p[0]' requires you to de-reference a void* pointer, which is a further extension over just allowing arithmetic on void* pointers.
Chris
Hello Chris.
I don't think that the observations above are providing a proper answer to my question (probably I wasn't clear enough). The point I was trying to stress is the current behavior of clang, which is flagging some of the uses of these extensions as _warnings_ and some other uses (syntactically different, but afaict semantically equivalent) as _errors_.
Since I guess the intention was to properly support such an extension, I think the latter should be reported as extension warnings too.
Regards,
Enea.