Among all the pre-processing commands, the # pragma command may be the most complex. It is used to set the compiler status or to instruct the compiler to complete some specific actions.# The Pragma command provides a method for each compiler to
When writing a program, we often use the # pragma command to set the compiler status or instruct the compiler to complete some specific actions.The following describes some common parameters of this command. I hope it will be helpful to you!
1.
Reprinted from: http://www.jysls.com/thread-19975-1-1.html
Among all the pre-processing commands, the # pragma command may be the most complex. It is used to set the compiler status or to instruct the compiler to complete some specific actions. #
Today, I started debugging windows core programming routines and it was very difficult to understand, because my c ++ skills were too weak.
First, a large number of macro problems are used in the Windows programming process.
# Pragma usage
Among all
Http://hi.baidu.com/zhanghuikl/blog/item/124ea7998108a9006e068c19.html
Emphasize one point:
#pragma packs (4)
typedef struct
{
Char buf[3];
Word A;
}KK;
#pragma pack ()
The principle of alignment is min (sizeof (word), 4) = 2, so it's 2-byte
From: http://hi.baidu.com/baiyw920/blog/item/7092d5fcdca37c1108244d73.html
_ Pragma and # pragma have the same functions. The difference is:1. # pragma is a Preprocessor command; __pragma is a keyword.2. for options such as # pragma,
[Reproduced from: http://www.cppblog.com/szhoftuncun/archive/2007/10/31/35356.html]# Difference between Pragma once and # ifndef
Specifies that the file will be encoded ded (opened) only once by the compiler when compiling a source code file.1 #
Before the KE read and save function, unexpectedly appears for{for{if{for{switch{if{for{}}}}}} such complex nesting, the code looks very faint. In this case, it is necessary to fold the code so that the logical relationship can be easily and
This morning, the difference between # ifndef and # pragma once was solved.
To differentiate # The macro definition difference between ifndef and # pragma once, I specially compiled a small program to test the process as follows:
1. Create two
How can I prevent header files from being repeatedly referenced?
There are two methods:1. Method 1:Use: # pragma once
2> Method 2:Use: # ifndef # define # endifExample:
# Ifndef XXXXXXX (a name should be unique as far as possible)
# Define XXXXXXX
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.