www.digitalmars.com         C & C++   DMDScript  

D - HexadecimalH

reply Alix Pexton <Alix thedjournal.com> writes:
In the D specs ("lex.html" to be precise) there is a production thus:

	HexadecimalH:
		HexDigits h
		HexDigits H
	
however the following code which should compile and run (printing
"3756") infact crashes the compiler (0.56):

int main(char[][] args){
    printf("%d\n", each);
    return 0;
}

If 'each' is first defined as an int and given a value, thus:

int main(char[][] args){
    int each = 1;
    printf("%d\n", each);
    return 0;
}

then the code compiles and when run the program prints "1".

Meanwhile, an identifier that does not match the HexadecimalH
production, thus:

int main(char[][] args){
    printf("%d\n", eachone);
    return 0;
}

is correctly reported as being undefined.

HexadecimalH (in this case at least) seems to be broken.

Do we really need it???

Alix...

-- 
             Alix Pexton
Webmaster - http://www.theDjournal.com

             Alix theDjournal.com
Feb 22 2003
next sibling parent Burton Radons <loth users.sourceforge.net> writes:
Alix Pexton wrote:
 In the D specs ("lex.html" to be precise) there is a production thus:
 
     HexadecimalH:
         HexDigits h
         HexDigits H
     

This should be: HexadecimalH: DecDigit h DecDigit H DecDigit HexDigits h DecDigit HexDigits H
 however the following code which should compile and run (printing
 "3756") infact crashes the compiler (0.56):
 
 int main(char[][] args){
    printf("%d\n", each);
    return 0;
 }

Err, it reports the correct error here on the same version.
Feb 22 2003
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"Alix Pexton" <Alix thedjournal.com> wrote in message
news:b3899j$1efj$1 digitaldaemon.com...
 HexadecimalH (in this case at least) seems to be broken.
 Do we really need it???

No, it should be removed from the doc. -Walter
Feb 22 2003
parent Alix Pexton <Alix thedjournal.com> writes:
Walter wrote:
 "Alix Pexton" <Alix thedjournal.com> wrote in message
 news:b3899j$1efj$1 digitaldaemon.com...
 
HexadecimalH (in this case at least) seems to be broken.
Do we really need it???

No, it should be removed from the doc. -Walter

On-line syntax highlighting for "The D journal" just got easier... Alix... -- Alix Pexton Webmaster - http://www.theDjournal.com Alix theDjournal.com
Feb 23 2003