我找到了一个代码段.我不明白.似乎变量__rem根本没用.下面的行还没有做任何有用的工作:
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
Run Code Online (Sandbox Code Playgroud)
整个代码段如下:
#define do_div(n,base) do{ \
uint32_t __base = (base); \
uint32_t __rem; \
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
if (((n) >> 32) == 0) { \
__rem = (uint32_t)(n) % __base; \
(n) = (uint32_t)(n) / __base; \
} else \
__rem = __div64_32(&(n), __base); \
__rem; \
}while(0)
/* Wrapper for do_div(). Doesn't modify dividend and returns
* the result, not reminder.
*/
static inline uint64_t lldiv(uint64_t dividend, uint32_t divisor)
{ …Run Code Online (Sandbox Code Playgroud) 我使用'malloc()'为C语言中的结构分配内存.部分结构如下:
struct f2fs_sb_info {
struct f2fs_fsck *fsck;
struct f2fs_super_block *raw_super;
struct f2fs_nm_info *nm_info;
struct f2fs_sm_info *sm_info;
struct f2fs_checkpoint *ckpt;
};
Run Code Online (Sandbox Code Playgroud)
我发现的值raw_super始终为零,而价值ckpt是永远0x40000050.
我知道malloc()不会初始化分配的内存.所以分配的内存应该是随机值.但是每次运行程序时,值ckpt始终0x40000050并且不会改变.为什么?