The difference between #define, const, typedef#define is not defining variables, it's just for text substitution.For example:#define PI 3.1415926float Angel;angel=30*pi/180;Then, when the program is compiled, the compiler will first "#define PI 3.141
When I executed get_defined_constants (), I accidentally found that PHP had an internal constant with the name true, a value of integer 1, and a constant known as false and null.
Does PHP handle true as a constant? Isn't it supposed to be a "value"?
In C ++, the difference between TRUE in upper case and true in lower case is true in lower case.
1. Differences between TRUE in uppercase and true in C ++True is of the bool type;TRUE is int type, which is defined by ms in VC;
C ++ does not allow
: This article mainly introduces the difference between const and define in php (supplement). If you are interested in PHP tutorials, refer to it. A constant is the identifier (name) of a simple value ). As its name implies, this value cannot be
As we all know, in PHP (PHP 4 and later), we can use the function define () to define constants, for example:
However, after PHP 5.3.0, in addition to using function define (), we can also use the PHP keyword const to define constants.
For example:
Value of Do{}while (0) When macro definition (#define) in C languageRecently found in the code of the new company everywhere used do{...} while (0), Google a bit, found that stack overflow early on a lot of discussion, summed up the discussion,
Let's look at a few examples
(1) struct{int x; int y;} Test1;
Well, define the structure test1,
test1.x and test1.y can be used in the statement.
(2) struct test {int x; int y;} Test1;
Well, define the structure test1,
test1.x and test1.y can be
Thanks to http://blog.chinaunix.net/u3/111961/showart_2187819.html first
. This is an excellent article.
In the last study, we wrote a small client example, which is very simple and the header file generated by using producer-binding-tool is very
A constant is an identifier (first name) of a simple value. As the name implies, the value cannot be changed during script execution (except for the so-called magic constants, they are not constants). Changshime is considered to be case sensitive.
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.