| | |
a few questions about C++ source code
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2008
Posts: 1
Reputation:
Solved Threads: 0
Hello,
I have, before my eyes, source code, 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
etABC() {};
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.
I have, before my eyes, source code, 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
etABC() {};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.
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
> #pragma - what does it mean
to understand what #pragma is see: http://msdn.microsoft.com/en-us/libr...05(vs.71).aspx
for the specific #pragma directives that are in your code, refer to your compiler docs.
> what does word __fastcall mean
__fastcall is an implementation-defined keyword in microsoft and several other compilers. it specifies a particular calling convention for a function.
http://msdn.microsoft.com/en-us/libr...sk(VS.71).aspx
> what does expression: k = 1 << i; mean?.
> (maskIO & 0x08) what does it mean?.
these are C/C++ bitwise operators. http://www.cprogramming.com/tutorial...operators.html
to understand what #pragma is see: http://msdn.microsoft.com/en-us/libr...05(vs.71).aspx
for the specific #pragma directives that are in your code, refer to your compiler docs.
> what does word __fastcall mean
__fastcall is an implementation-defined keyword in microsoft and several other compilers. it specifies a particular calling convention for a function.
http://msdn.microsoft.com/en-us/libr...sk(VS.71).aspx
> what does expression: k = 1 << i; mean?.
> (maskIO & 0x08) what does it mean?.
these are C/C++ bitwise operators. http://www.cprogramming.com/tutorial...operators.html
•
•
Join Date: Oct 2007
Posts: 305
Reputation:
Solved Threads: 43
I will try to answer these .. but I'd suggest looking them up online also.
1. #pragma is a compiler directive. For example #pragma pack(n) .. specifies the packing alignment for structures and unions (ie 1 byte boundary, 4 byte boundary and so forth).
here is some more information.
2. for _fastcall see here
3. k = 1 << i : << is the shift left operator. In this case you are left shifting 1 by i bits, and assigning the result to k.
For example if i = 3, then you are doing 0000 00001 << 3 = 0000 0100 = 4
4. maskIO & 0x08 does a bitwise AND of hexadecimal 08 with maskIO. Lets assume maskIO is 10.
0000 1010
AND 0000 1000
------------
0000 1000
so if maskIO has the same bits ON as 0x08 then your signal is set to enabled.
See here for more info about Bitwise Operations.
1. #pragma is a compiler directive. For example #pragma pack(n) .. specifies the packing alignment for structures and unions (ie 1 byte boundary, 4 byte boundary and so forth).
here is some more information.
2. for _fastcall see here
3. k = 1 << i : << is the shift left operator. In this case you are left shifting 1 by i bits, and assigning the result to k.
For example if i = 3, then you are doing 0000 00001 << 3 = 0000 0100 = 4
4. maskIO & 0x08 does a bitwise AND of hexadecimal 08 with maskIO. Lets assume maskIO is 10.
0000 1010
AND 0000 1000
------------
0000 1000
so if maskIO has the same bits ON as 0x08 then your signal is set to enabled.
See here for more info about Bitwise Operations.
![]() |
Similar Threads
- I have a few questions to be patched up can anybody get these to me ? (C++)
- source code to insert data into database using javabean (Java)
- help!..VerySimple web browser(display source code of web pages) (JSP)
- <jsp:include> Not Printing On Web Page, But In Source Code (JSP)
- Skipping Questions in my ASP survey (ASP)
- How to make windows form from c++ code (GUI) (C++)
- FORUMS - certain facts and questions with respect to everyone (Growing an Online Community)
- Two C++ questions. (C++)
Other Threads in the C++ Forum
- Previous Thread: Container Adapter Confusion
- Next Thread: mfc
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






