Is *((thing *)p)++ legal? 
Author Message
 Is *((thing *)p)++ legal?

On 28 Aug 1994 04:32:12 GMT,

Quote:

>: Consider the following:

>:       double d= 1.2;
>:       void *p= &d;
>:       double *pd= &d;
>:      
>:       d= *pd++;               // ok
>:       d= *((double *)p)++;    // ok?
>:      
>:       pd++;                   // ok
>:       ((double *)p)++;        // ok?

Borland C++ 3.1 treats both the cases the same, as one can see in
assembly output. Why do other compilers complain ?

                     >> Wojciech Galazka <<

| Computer Center, Chemistry Department,  University of Warsaw
| Pasteura 1, 02-093 Warsaw, Poland          
                 ->> A happy FreeBSD user <<-



Fri, 21 Feb 1997 18:21:50 GMT  
 Is *((thing *)p)++ legal?

Quote:
>On 28 Aug 1994 04:32:12 GMT,


>>: Consider the following:

>>:       double d= 1.2;
>>:       void *p= &d;
>>:       double *pd= &d;
>>:      
>>:       d= *pd++;               // ok
>>:       d= *((double *)p)++;    // ok?
>>:      
>>:       pd++;                   // ok
>>:       ((double *)p)++;        // ok?

>Borland C++ 3.1 treats both the cases the same, as one can see in
>assembly output. Why do other compilers complain ?

Because they are not broken. Is BC++ 3.1 silently accepting the illegal
expression even in ANSI compatibility mode? If the answer is yes, try
to find a different compiler, one which understands and implements the
C language.

Dan
--
Dan Pop
CERN, CN Division

Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland



Fri, 21 Feb 1997 18:52:40 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Is *((thing *)p)++ legal?

2. Side Effects: Good Thing or Bad Thing

3. I am new to programming and am lost

4. is this legal C initializer? Or, what am I doing wrong

5. DLL Hell - I touched the wrong thing, now I am punished.

6. Creating an NT service (am I doing the right thing?)

7. Beginner question: is *s = 1 legal?

8. Is this legal C ?

9. Initialize array from members of a struct: Legal ?

10. Re : Re: Is this legal C?

11. Is this legal prototype syntax?

 

 
Powered by phpBB® Forum Software