[ROOT] RE:Re: RE:no error on invalid array initial

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Sun Dec 03 2000 - 09:59:24 MET


Hello David,

Thank you for your comment.

About detecting error when finding space in a numerical literal,
I'd like to keep current behavior for following reason.  Having
space within a numerical literal is sometimes convenient.


Cint has a special extension in order to deal with binary expression.
This capability is useful for electrical engineering, especially 
logic hardware design.

   test1() {
     int x = 0b 0010 1101 0010 1111; 
     printf("%b\n",x);
   }

The function test1 handles binary expression as an integer and prints
it out as binary. When writing long list of bits, I want to insert
spaces.  Further, cint can handle 4 value logic as follows.

   typedef double logic;
   test2() {
     logic x = 0b xx0z 10xz zzzz 0000;
     printf("%b\n",x);

     logic pattern[] = {
       0b 0101 1101 xxxx 0110,
       0b 1101 x011 0010 xx01,
       0b 0001 zzzz 0010 xx01,
       0b 0011 0010 0011 1010
     };
     int patternSize = sizeof(pattern)/sizeof(logic);
     for(int i=0;i<patternSize;i++) {
       printf("V { PAT=%16b; }\n",pattern[i]);
     }
   }

'z' is a high-impedance and 'x' is unknown. This expression is similar
to IEEE 1364 Verilog Hardware Description Language which is aimed at
designing computer hardware.  This may look quite exotic to you, but
this is convenient for my kind of work.

Thank you for your understanding,
Masaharu Goto



>Hi,
>   Sorry if the comments accompanying my code were misleading.
>   I added the include and "main" simply so that the code could compile 
>with g++ -- I'm (mostly) aware of how to use the ROOT interpreter.
>   What I was trying to point out is that within the array initializer, 
>ROOT is accepting what g++ considers to be an invalid float declaration. 
>(There is a comma "missing" between the last two elements of the array 
>initializer.) I just thought it might be better if the behavior of ROOT and 
>g++ in this case (of an apparently invalid float declaration within an 
>array initializer) was the same.
>   Sorry again for the confusion.
>   Thank you for your time.
>
>David



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET