Explain Legal Function Naming with sample code

Questions by prettyfox

Showing Answers 1 - 3 of 3 Answers

OSaienni

  • Sep 10th, 2008
 

A is the only one that will work.

The reason are :

!, - are operators,

# is the preprocessor operator.
     #define, #pragma, also use #9 -> stringify value to char.


1 - numeric value (can be used at end of function / method)

$ isn't used in C++ (I may be wrong here but I've never used $) - So legal naming as its not a number/operator

$_foo()
$ symbol is used by compiler in a process called "name mangling",where each functions name and signature are preceded by $.
Thus $ is a valid symbol that a compiler can understand.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions