What is Eclipse/GNU doing?

Topics for the Eclipse Environment
Post Reply
SeeCwriter
Posts: 606
Joined: Mon May 12, 2008 10:55 am

What is Eclipse/GNU doing?

Post by SeeCwriter »

Given the code snippets below, why doesn't the compiler (v2.9.2) throw an error and why doesn't the program crash in function Init()?

Code: Select all

////////// Header…
class c_interval            // interval timer based on TimeTick
  {
  public:
  volatile DWORD start_time, timeout, interval;
  explicit c_interval( DWORD msec = 1000 ); // interval in msec.
  void  Reset(DWORD msec=0);  
  bool  Cycle(DWORD msec=0); 	
  bool  Expired();            
  DWORD ElapsedSec();
  DWORD ElapsedMsec();
  DWORD RemainingSec();
  void  ForceExpiration();	
  };

struct s_amp_info
  {
  int   connected;
  c_interval cooldown; 
…


////////// Init()…
  s_amp_info *pamp = amp_info+amp;
  pamp->cooldown = 0;         // What does this do?! 
  pamp->cooldown.Reset(60000);  // Works.
  
jandarm
Posts: 7
Joined: Sat Dec 07, 2019 2:35 pm

Re: What is Eclipse/GNU doing?

Post by jandarm »

SeeCwriter,

where amp and amp_info are defined/declared? We aren't telepaths.

In the line

Code: Select all

pamp->cooldown = 0;         // What does this do?!
I guess default assignment operator is called. It's hard to say what is going on without full listings.
Post Reply