Solved

what does "SUPER " mean?

Posted on 2001-07-09
4
307 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Connecting to MS SQL db from Win32 application written in C 3 85
White board coding practice 3 88
max float value 3 41
c++, dynamic object by json 1 42
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

803 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