Solved

what does "SUPER " mean?

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

760 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

17 Experts available now in Live!

Get 1:1 Help Now