God save my delusional compiler...

Started by
7 comments, last by Vendayan 21 years, 5 months ago
please don''t flame me... please... Can anyone identify what forms of LSD my computer has been ingesting? cSky.h
  
class cSky
{
	public:
		cSky();
		virtual ~cSky();

		virtual bool Render();

	private:

};

class cSkyBox : public cSky
{
	public:
		cSkyBox();
		virtual ~cSkyBox();
		
		virtual bool Render();

	private:

};

class cSkyDome : public cSky
{
	public:
		cSkyDome();
		virtual ~cSkyDome();
		
		virtual bool Render();

	private:

}
  
cSky.cpp
  
cSky::cSky()
{

}

cSky::~cSky()
{

}

cSkyBox::cSkyBox()
{

}

cSkyBox::~cSkyBox()
{

}
  
cSky.cpp(13) : error C2533: ''cSky::cSky'' : constructors not allowed a return type cSky.cpp(23) : error C2264: ''cSky::cSky'' : error in function definition or declaration; function not called Thanks ~Vendayan
"Never have a battle of wits with an unarmed man. He will surely attempt to disarm you as well"~Vendayan
Advertisement
A missing semicolon at the end of cSkyDome?
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
You''re missing a semi-colon.
char a[99999],*p=a;int main(int c,char**V){char*v=c>0?1[V]:(char*)V;if(c>=0)for(;*v&&93!=*v;){62==*v&&++p||60==*v&&--p||43==*v&&++*p||45==*v&&--*p||44==*v&&(*p=getchar())||46==*v&&putchar(*p)||91==*v&&(*p&&main(0,(char**)(--v+2))||(v=(char*)main(-1,(char**)++v)-1));++v;}else for(c=1;c;c+=(91==*v)-(93==*v),++v);return(int)v;}  /*** drpizza@battleaxe.net ***/
White Mitsubishi, probably 5 or 6 tabs.
Thanks SmartIdiot and DrPizza, although I still dont see why my compiler would take that as my constructor trying to return a value. So I blame my compiler''s addiction to LSD and not my own incompetence.

~Vendayan
"Never have a battle of wits with an unarmed man. He will surely attempt to disarm you as well"~Vendayan
quote:Original post by Vendayan
Thanks SmartIdiot and DrPizza, although I still dont see why my compiler would take that as my constructor trying to return a value. So I blame my compiler''s addiction to LSD and not my own incompetence.

The class definition hasn''t been terminated, so the compiler continues eating symbols and parses a ctor definition. It puts 2 and 2 together and figures out the class must be the return type for the ctor, which is the first diagnosable error it encounters.
The reason you need a semicolon at the end is because you declare objects at the end of the class (especially if it's a nameless class)

Your compiler gave that rather strange error because it saw the constructor right after it, and assumed you were trying to return an instance of type cSkyDome.

edit:

As SabreMan was saying before I rudely interupted him

[edited by - smart_idiot on November 20, 2002 12:54:03 PM]
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
quote:Original post by Vendayan
So I blame my compiler''s addiction to LSD and not my own incompetence.
~Vendayan


yes, they''ve yet to invent the "do as i want, not as i say" compiler.
Thanks although I must admit I never knew you could define a class at the same time that you declare an instance of it.

~Vendayan
"Never have a battle of wits with an unarmed man. He will surely attempt to disarm you as well"~Vendayan

This topic is closed to new replies.

Advertisement