What does this code mean?

S

Sier

CL_ConsoleWindow console("Console");

Is this some c++ idiom or a macro? I know you can't tell without the
headers, but I want a quick explanation.
 
J

Jacques Labuschagne

Sier said:
CL_ConsoleWindow console("Console");

Is this some c++ idiom or a macro? I know you can't tell without the
headers, but I want a quick explanation.

Looks like it's declaring an object called 'console' with type
'CL_ConsoleWindow'. The constructor of that object is being
passed the const char* "Console".

Nothing odd there... Like you say, we could tell you more with headers.

Jacques.
 
S

Sier

Looks like it's declaring an object called 'console' with type
'CL_ConsoleWindow'. The constructor of that object is being
passed the const char* "Console".

Yes, but doesn't it have a name? Sorry but I'm inexperienced with C++.
 
S

Seth Morecraft

Sier said:
CL_ConsoleWindow console("Console");

Is this some c++ idiom or a macro? I know you can't tell without the
headers, but I want a quick explanation.


This is straight from the Clanlid Game SDK (http://www.clanlib.org)
- From the Examples:
// Create a console window for text-output if not available
CL_ConsoleWindow console("Debug Console");
Check out the documentation of the Clanlib package for more information
on what it does- but the comment really says it all. Hope this helps!

Seth

~ Let us linux ~
 
C

Catalin Pitis

Sier said:
Yes, but doesn't it have a name? Sorry but I'm inexperienced with C++.

If you are refering to the constructor name, it is the same as the class
name. This is the way an object is built at declaration time (the
constructor doesn't appear explicitly in the declaration).

Catalin
 
D

Dan Cernat

Sier said:
CL_ConsoleWindow console("Console");

Is this some c++ idiom or a macro? I know you can't tell without the
headers, but I want a quick explanation.

apparently this is a variable declaration:

it declares a variable named 'console' of type 'CL_ConsoleWindow' and
initializes it with the string "Console"

Dan
 
S

Sier

This is the way an object is built at declaration time (the
constructor doesn't appear explicitly in the declaration).

That's what I had forgot from my little experience with c++. I plan to
work with this library and I wanted to be comfortable with the c++
syntax before I start working on a project.
 
J

jeffc

Sier said:
CL_ConsoleWindow console("Console");

Is this some c++ idiom or a macro? I know you can't tell without the
headers, but I want a quick explanation.

It's not a known C++ idiom or macro. It looks like Windows stuff to me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top