Fwd: Re: variable type cast
Maurice Lombardi <[email protected]>
| Newsgroups | gmane.comp.compilers.gpc |
|---|---|
| Message-ID | <[email protected]> |
-------- Message original -------- Sujet: Re: variable type cast Date : Mon, 13 May 2013 09:11:11 +0200 De : Maurice Lombardi <[email protected]> Pour : Jay Michael <[email protected]> Le 13/05/2013 01:12, Jay Michael a écrit : > gpc version 20070904, based on gcc-3.4.5 (mingw special) > Given > type INT16 = INTEGER attribute( size=16 ) ; > type WORD16 = Cardinal attribute( size=16 ) ; > var i16 : INT16 ; > var w16 : WORD16 ; > why does > WORD16(I16) := W16 ; > produce "error: invalid lvalue in assignment"? First notice tht the other way around I16 := INT16(W16) ; works. Typecasts are C style unportable "extensions" which garble the "write once, compile everywhere" philosophy behind the strong typing principles of Pascal. There is certainly nothing about it in the standards, and I do not know at which point this "lvalue error" crept in first into C, and then into Pascal. Maurice -- Maurice Lombardi Laboratoire Interdisciplinaire de Physique, (ex Spectrometrie Physique) Universite Joseph Fourier de Grenoble, BP87 38402 Saint Martin d'Heres Cedex FRANCE Tel: 33 (0)4 76 51 47 51 Fax: 33 (0)4 76 63 54 95 mailto:[email protected] _______________________________________________ Gpc mailing list [email protected] https://www.g-n-u.de/mailman/listinfo/gpc