I tried Philipp's code on gcc and it worked, which confirms Puneet's story.
John A
-----owner-systemc-p1666-technical@eda.org wrote: -----
To: David C Black <dcblack@xtreme-eda.com>
From: Puneet Goel
Sent by: owner-systemc-p1666-technical@eda.org
Date: 09/14/2010 04:56AM
Cc: "Philipp A. Hartmann" <philipp.hartmann@offis.de>, SystemC P1666 Technical <systemc-p1666-technical@eda.org>
Subject: Re: Next priority: Maximum value of simulation time
Greetings
> I don't think a local static will work because it will get created before
> main() if I recall the correct semantics of C++.
Section 7.1.2 Stroustrup The C++ Programming Language
If a local variable is declared static, a single, statically allocated object will be used to represent that variable in all calls of the function. It will be initialized only the first time the thread of execution reaches its definition.
In our case (as suggested by Phillipp) that would happen only when the first call to sc_max_time() is made.
Regards
- Puneet
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Tue Sep 14 02:25:35 2010
This archive was generated by hypermail 2.1.8 : Tue Sep 14 2010 - 02:25:35 PDT