This is the mail archive of the
mailing list for the GCC project.
Re: void* vs void *
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Magnus Fromreide <magfr at lysator dot liu dot se>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 29 Jan 2016 23:55:52 +0000
- Subject: Re: void* vs void *
- Authentication-results: sourceware.org; auth=none
- References: <20160129181300 dot GA25222 at faust dot lysator dot liu dot se>
On 29 January 2016 at 18:13, Magnus Fromreide wrote:
> I just noticed that the C and C++ compiler output pointer types differently:
> 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++.