Solved

what does "SUPER " mean?

Posted on 2001-07-09
4
306 Views
Last Modified: 2008-03-06
in the following:

#define SUPER TTActor

what does "SUPER " mean?

tks

0
Comment
Question by:she25
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 30 total points
ID: 6267479
It means "TTActor"

Anythign else?  :-)

what you are looking at is a C Pre-processor statement (any statement that begins with "#" at the start of the line.)  In this case it is a pre-processor #define statement.  This statement is used to create pre-procssor definitions and macros.

In this case it creates a pre-processor defintion.  The definition is for the word "SUPER"  which it defines as "TTActor"  The pre-processor will look through the code and will look for any occurance of "SUPPER" in the code (not in comments or strings) an will replace it with "TTActor".

continues

0
 
LVL 4

Expert Comment

by:newmang
ID: 6267484
It doesn't "mean" anything. The line creates an "alias" for TTActor named SUPER.

For example

#define BUFFSIZE 256
char   sz_buffer[BUFFSIZE+1];

strncpy(sz_buffer,source_data,BUFFSIZE);

0
 
LVL 22

Expert Comment

by:nietod
ID: 6267491
So for example, if your code was like

#define SUPER TTActor

class TTActor
{
};

SUPER AnActor;

the pre-processor would convert the code to

#define SUPER TTActor

class TTActor
{
};

TTActor AnActor;

Note that this sort of use of the pre-processor is now strongly discouraged.  It was often necessary to use the pre-processor in C, but it also caused lots of problems.  So C+++ provides better alternatives for almost all the features of the pre-processor.   There are still two areas where the pre-processor stil needs to be used, it needs to be used for #include directives and for conditional compilation directives. Like the #ifdef include guards used in many include files.  (These conditional compilations situations often require that #define be used, but the vlaues defined are only used by the pre-processor, they do not direcly affect the code.)
0
 
LVL 22

Expert Comment

by:nietod
ID: 6267498
This

>> #define BUFFSIZE 256
>> char   sz_buffer[BUFFSIZE+1];

is one of the things that the pre-processor should not be used for. (In C++, it was necesary in C.).  For example the code

const int BUFFSIZE = 256;
char   sz_buffer[BUFFSIZE+1];

is far better.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now