Discussion: variable declaration
Afficher un message
Vieux 21/02/2008, 23h22   #6
Jeff Schwab
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: variable declaration

Jeff Schwab wrote:
> Juha Nieminen wrote:
>> Victor Bazarov wrote:
>>> The '*' symbol cannot be followed by 'int'.

>>
>> result = a * int (b);

>
> What compiler does that? GCC 4.2 rejects both of these:
>
> int main() { const * int ptr; }
> int main() { void* ptr = 0; const * int ptr; }
>
> Both cases cause the same diagnostic:
>
> g++ -ansi -pedantic -Wall main.cc -o main
> main.cc: In function 'int main()':
> main.cc:1: error: expected unqualified-id before 'int'
> main.cc:1: error: expected initializer before 'int'


I should have mentioned that trying to assign "a * int b" produces a
similar diagnostic: "expected primary-expression before 'int'".
  Réponse avec citation
 
Page generated in 0,04360 seconds with 9 queries