× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Lim and the gang -

Hi Lim -

>Go figure these out:
>
>This one failed to compile:
>D ind1            c                   const(*on)
>C                   if        ind1
>C                   endif
>C                   eval      *inlr = *on
>
>This one compiled just fine:
>D ind2            c                   const('1')
>C                   if        ind2
>C                   endif
>C                   eval      *inlr = *on

Perhaps in the first example the compiler is creating a three-byte
character constant that contains either '*ON' or '*on' rather than
interpreting it as a true/false value and creating a one-byte character
constant that contains '1'.

You can test this by creating a three-byte field, eval SUCCESSFUL into it
when defined as const(*on) and see what the value of the field is.

I played around with this when I got back to work. (I posted the above from home on my lunch hour.) The compiler is NOT creating a constant containing '*ON' or '*on'.

It IS creating an indeterminate length constant, just like *on itself is.

A little testing using direct values rather than named constants showed:

return *on      ====> compiles
return not *on  ====> REJECTED
return '1'      ====> compiles
return not '1'  ====> compiles

Since 'not *on' doesn't work, the fact that 'not SUCCESSFUL' doesn't work obviously isn't a problem with the constant definition, but the fact that *on is not 'not'-able, I suspect because of its indeterminate length. (I've found a number of situations where the compiler does not allow the use of an indeterminate length constant where it seems to me to there is no real reason not to. This is another one of those situations.)

Ken
http://www.kensims.net/
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.