Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

what does "SUPER " mean?

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

828 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