a pointer to a function returning an integer.
In this HIG is pointer to function which taking two arguments first as int and second as int type. And the function HIG return int type.
Is there anyway to use a "sizeof" in a pre-processor macro?
No. The conditional directives take a restricted set of conditional expressions; sizeof is one of the things not allowed.
Preprocessing directives are evaluated before the source is parsed (at least conceptually), so there aren't any types or variables yet to get their size.
You have explained what HIG is! but, what typedef is doing here in this expression ?
typedef defines new names for the data types. so what is the old data name and what is the new data name in this ?
For ex: typedef int Length
In this, Length is new name for int. so what is new and old name in the above asked expression ?
ok,i understand the second point. can you tell me the other conditions like sizeof, which can't come in preprocessor ? Also, but sizeof is valid in #define statements althoguh it is also preprocessor. how is it possible then ?
In this statement HIG is the name of the new type, the type it is defined to is int (*)(int,int). This statement is defining a type that is a point to a function that returns int and takes 2 integers as parameters, as always the syntax for creating a typedef is exactly the same as the syntax for declaring a variable of that type, that is
int (*fnPtr) (int,int);
typedef int (*HIG) (int,int);
are functionally equivilent, they both create a variable, fnPtr, with a type of int (*) (int,int).
You can't use sizeof in #if because #if is evaluated completely by the preprocessor (which runs first) but sizeof is evaluated by the compiler (which runs second).
However you can use sizeof in #define because the processors evaluation of #define is to set-up a text substitution so it you have a definition like this
#define SIZE(x) (sizeof(x))
the proprocess replaces every occurance of SIZE it finds in the code with what is in the rest of the macro definition (sizeof in this case) with out actually evaluating the new text it has inserted. The compiler comes along later and evaulates the code so the compiler never sees the SIZE but does see and evaluate the sizeof.
oh! really awesome explaination. I must say that this type of explaination can't be get by anyone, even after searching whole google.com. HATS off! thanks alot to you sir/mam. really thanks.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...