Home >Backend Development >PHP Tutorial >basic data structure
First, the integer type:
src/core/ngx_config.h
<code><span>typedef</span> intptr_t ngx_int_t; <span>typedef</span> uintptr_t ngx_uint_t; <span>typedef</span> intptr_t ngx_flag_t;</code>
That is, integer, unsigned integer and bool. Three types such as intptr_t are defined as follows:
/usr/local/include/stdint.h
<code><span>/* Types for `void *' pointers. */</span><span>#if __WORDSIZE == 64</span><span># ifndef __intptr_t_defined</span> typedef <span>long</span><span>int</span> intptr_t; <span># define __intptr_t_defined</span><span># endif</span> typedef unsigned <span>long</span><span>int</span> uintptr_t; <span>#else</span><span># ifndef __intptr_t_defined</span> typedef <span>int</span> intptr_t; <span># define __intptr_t_defined</span><span># endif</span> typedef unsigned <span>int</span> uintptr_t; <span>#endif</span></code>
That is: 64-bit system uses long integer (8 bytes), otherwise uses integer (4 bytes).
Then the string type:
/src/core/ngx_string.h
<code><span>typedef</span> struct { size_t len; u_char *<span><span>data</span>;</span> } ngx_str_t; </code>
Next, a bunch of string-related functions are defined, similar to the member functions corresponding to ngx_str_t.
Function | Description |
---|---|
ngx_string(str) | Constructor, str points to The error number is defined in src/os/unix/ngx_errno.h |
Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission. | |
The above has introduced the basic data structure, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials. |