pointer syntax

spir denis.spir at gmail.com
Fri Oct 29 05:47:26 PDT 2010


Hello,

I have a little issue with pointer syntax:

    auto toS = &("abc") ;	// ok
    auto toS = &"abc" ;		// ok

    auto toI = &(1) ;		// Error: constant 1 is not an lvalue
    auto toI = &1 ;		// Error: constant 1 is not an lvalue

The only solution I found is:

    auto i = 1 ;
    auto toI = &i ;

It seems to be a pure syntactic problem. But why does it work with strings? "abc" is no more a lvalue, I guess.

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list