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: void* vs void *


On 29 January 2016 at 18:13, Magnus Fromreide wrote:
> I just noticed that the C and C++ compiler output pointer types differently:
>
> Consider
>
> int i;
> printf("%p", &i);
>
> When compiled as C that gives the warning
>
> format '%p' expects argument of type 'void *', but argument 2 has type 'int *'
>
> but when compiled as C++ it gives the warning
>
> format '%p' expects argument of type 'void*', but argument 2 has type 'int*'
>
> Why are they different?

Just a guess, but maybe because it's common to place the * differently
in idiomatic C++.

http://stroustrup.com/bs_faq2.html#whitespace


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