Re: Request help with function pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shriramana Sharma wrote:

> > Remove the space in ". *" and "-> *".
> 
> Thank you very much -- that worked, but is there any good reason why I
> should not be allowed to put a space there? When I can use:
> 
> :: *
> 
> in the same programs without an error, why can't I use
> 
> . *
> 
> or
> 
> -> *

Because ".*" and "->*" are tokens, and you can't have a space in the
middle of an token, in the same way that you can't put a space in the
middle of "++", "+=", ">=" etc.

".*" looks like a combination of "." and "*", and "->*" looks like a
combination of "->" and "*", and in a sense they behave that way, but
".*" and "->*" are actually separate tokens, not a combination.

> (I like having my code neatly and generously spaced since I feel it
> looks cleaner.)
> 
> I get no problem if I space the . and -> in other cases like:
> 
> QWidget . show () ;
> 
> or
> 
> this -> show () ;

Here, "." and "->" are tokens. Putting a space between the "-" and ">"
in "->" would similarly result in an error, as would a space in the
middle of "th is". You can put a space between "(" and ")", though.

> So if there is no good reason for not being allowed to put a space
> between . and * or -> and *, I can report a bug against gcc asking for
> this error to be removed for being meaningless.

No, gcc is correct.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux