Re: SC_IS_PRERELEASE and TLM_IS_PRERELEASE

From: Philipp A. Hartmann <philipp.hartmann@offis.de>
Date: Mon Jan 17 2011 - 15:31:32 PST

John,

I've checked this issue on MS Visual C++ as well. There, TRUE/FALSE are
defined (due to windows.h) and unfortunaly true/false are not supported
as constant expression (although they should, according to my
understanding of the C++ standard).

  A platform independent definition should then use 1/0, respectively.
Thus, the extended wording from my last mail seems to be the best way to
go. The implementer can then provide a suitable definition for all the
supported platforms.

Opinions?

Greetings from Oldenburg,
  Philipp

On 12/01/11 15:42, Philipp A. Hartmann wrote:
> John,
>
> On 12/01/11 15:13, john.aynsley@doulos.com wrote:
>>
>> What precisely are you proposing we do instead?
>
> For simplicity, I would propose to just spell 'false' and 'true' in
> lower-case. These are valid constant expressions for the C(++)
> preprocessor, evaluating to 0 and 1.
>
> A more elaborate definition could use the following:
>
> The TLM_IS_PRERELEASE flag shall be a controlling constant expression
> (see ISO/IEC14882:2003, 16.1(4)), evaluating to 0 or 1, respectively.
>
> Greetings from Oldenburg,
> Philipp
>
>
>
>> From:
>> "Philipp A. Hartmann" <philipp.hartmann@offis.de>
>> To:
>> john.aynsley@doulos.com
>> Cc:
>> systemc-p1666-technical@eda.org
>> Date:
>> 12/01/2011 01:45
>> Subject:
>> Re: SC_IS_PRERELEASE and TLM_IS_PRERELEASE
>>
>>
>>
>> John, all,
>>
>> I've checked this again. TRUE and FALSE are neither part of the C nor
>> the C++ standard.
>>
>> They are defined by some platforms (e.g. on Windows), and also
>> commonly defined in C applications, but the latter mostly due to the
>> lack of proper bool support.
>>
>> Wrt. to backwards compatibility, I highly doubt that there are
>> frequent uses of this, since the current TLM-2 kit is just broken in
>> that regard. Try the following on a non-Windows platform:
>>
>> // ---8<---
>> #include <systemc>
>> #include <tlm.h>
>>
>> int sc_main( int, char*[] )
>> {
>> # if TLM_IS_PRERELEASE == TRUE
>> std::cout << "TLM pre-release" << std::endl;
>> # endif
>>
>> # if TLM_IS_PRERELEASE == FALSE
>> std::cout << "TLM not a pre-release" << std::endl;
>> # endif
>> return 0;
>> }
>> // --->8---
>>
>> This prints, _both_ lines on my default Linux/GCC 4.4 platform, since
>> TRUE and FALSE are undefined. And comparing two undefined symbols is
>> quite ? undefined. ;-)
>>
>> Greetings from Oldenburg,
>> Philipp
>>
>> On 11/01/11 13:37, john.aynsley@doulos.com wrote:
>>> All,
>>>
>>> Philipp writes:
>>>
>>>
>>> 9.6.5 SystemC Version
>>> 11.8.1 TLM version information
>>>
>>> SC_IS_PRERELEASE
>>> TLM_IS_PRERELEASE
>>>
>>> "... flag shall be either FALSE or TRUE, not enclosed in quotation
>>> marks."
>>>
>>> Hmmm, maybe 'true' or 'false' (lower-case) would be more portable?
>>> Or even an application-defined integral constant expression evaluating
>>
>>> to 0/1 (or false/true).
>>>
>>>
>>> [JA] I guess FALSE and TRUE are still required for backward
>> compatibility
>>> in the TLM-2.0 world?

-- 
Philipp A. Hartmann
Hardware/Software Design Methodology Group
OFFIS Institute for Information Technology
R&D Division Transportation · FuE-Bereich Verkehr
Escherweg 2 · 26121 Oldenburg · Germany · http://offis.de/en/
Phone/Fax: +49-441-9722-420/282 · PGP: 0x9161A5C0 · Skype: phi.har
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Jan 17 15:31:59 2011

This archive was generated by hypermail 2.1.8 : Mon Jan 17 2011 - 15:32:03 PST