LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   a few questions about C++ source code (https://www.linuxquestions.org/questions/programming-9/a-few-questions-about-c-source-code-672440/)

mac1234mac 09-26-2008 12:36 AM

a few questions about C++ source code
 
Hello,

I have certain source code before my eyes, but I Can't understand certain parts of it:

1. #pragma - what does it mean, is it some directive for precompilator?.
for example: what does it mean - #pragma resource "*.dfm;" or
or #pragma package (smart_init);?.
2. what does word __fastcall mean in expression
int __fastcall ABC:SetABC() {};
3. what does expression: k = 1 << i; mean?.
4. what is the effect of running following line of text:
SignalForm->CheckBox20->Enabled = (maskIO & 0x08) ? true :
false;
I particularly mean expression in parenthesis: (maskIO & 0x08) what
does it mean?.
Shouldn't there be applied bit conjunction operator?.

Thank You for answer.

jf.argentino 09-26-2008 02:24 AM

1°) #pragma are preprocessor directives, like everything beginning with a #
2°) __fastcall is a function calling convention
3°) "<<" is the bit shift operator
4°) (TEST) ? (WHEN_TRUE) : (WHEN_FALSE) is evaluated to "WHEN_TRUE" when TEST is true, WHEN_FALSE otherwise, & is the bitwise and operator

Try google for something like #pragma or __fastcall doesn't take more time than posting... And a C++ tutorial could be intersting too

pinniped 09-26-2008 02:31 AM

#pragma directives are non-portable compiler directives; you need to look at the documentation for the compiler which is intended to build that software to find out what a particular #pragma does.

The '&' is the bitwise AND operator (see any book on the C compiler).
So (maskIO & 0x08) results in '0x80' (128 in unsigned decimal) if bit 3 of the maskIO variable is set and '0' otherwise.


All times are GMT -5. The time now is 08:22 PM.