public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* incompatibility between g++ and vc++
@ 2004-06-09  9:06 Vincent Torri
  2004-06-09 11:45 ` Eljay Love-Jensen
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Torri @ 2004-06-09  9:06 UTC (permalink / raw)
  To: gcc-help


Hello,

one of my friend is writing a c++ program and compile it with vc++ on
windows. He has no compilation error.

I wanted to test it on linux, but g++ report an error.

Here is a part of the source code : 

template <class Clock> class timer : boost::noncopyable
{

  static Clock const clock_;   //Clock instance

  // methods

  ...


};

//instantation of the clock_ static member
template <class Clock>
Clock const timer<Clock>::clock_;


And g++ reports this error:
                               
l98: uninitialized const                                                        
`avs::timing::timer<avs::timing::ThreadClock>::clock_' 

I have tried to understand why g++ reduses to initialize clock_, without
success.

Does someone know where (what) is the error ? If you want more code, tell
me.

Thank you !

Vincent TORRI


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: incompatibility between g++ and vc++
  2004-06-09  9:06 incompatibility between g++ and vc++ Vincent Torri
@ 2004-06-09 11:45 ` Eljay Love-Jensen
  2004-06-15 22:13   ` Vincent Torri
  0 siblings, 1 reply; 3+ messages in thread
From: Eljay Love-Jensen @ 2004-06-09 11:45 UTC (permalink / raw)
  To: Vincent Torri, gcc-help

Hi Vincent,

I believe that MSVC++ is not compliant to ISO 14882 in this case.

Try this instead:

template <class Clock>
Clock const timer<Clock>::clock_ = Clock();

(Hmmm, shouldn't that be a "static Clock const volatile clock_;", since you 
don't want it cached-optimized?)

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: incompatibility between g++ and vc++
  2004-06-09 11:45 ` Eljay Love-Jensen
@ 2004-06-15 22:13   ` Vincent Torri
  0 siblings, 0 replies; 3+ messages in thread
From: Vincent Torri @ 2004-06-15 22:13 UTC (permalink / raw)
  To: Eljay Love-Jensen; +Cc: gcc-help



On Wed, 9 Jun 2004, Eljay Love-Jensen wrote:

> Hi Vincent,
> 
> I believe that MSVC++ is not compliant to ISO 14882 in this case.
> 
> Try this instead:
> 
> template <class Clock>
> Clock const timer<Clock>::clock_ = Clock();
> 
> (Hmmm, shouldn't that be a "static Clock const volatile clock_;", since you 
> don't want it cached-optimized?)
> 
> HTH,
> --Eljay

Thank you very much, it works that way !

Vincent TORRI

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-06-15 22:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-09  9:06 incompatibility between g++ and vc++ Vincent Torri
2004-06-09 11:45 ` Eljay Love-Jensen
2004-06-15 22:13   ` Vincent Torri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).