"Sometimes, I am confused when I choose to repost and create an original project, and I am so confused about how much I know"
--------------------------------------
Preface:
Although variable parameters can be executed poorly, they may be affected by the platform, such as the CPU arch, the size end, And the stack growth. However, if you do not consider these parameters, you can use them to complete some tips.
Note: # pragma print ???
1. va_arg
Va_arg (ARGs, bool) va_arg (ARGs, char)
These two statements run normally, but note prompts in Linux compilation that there will be a command error and the runtime will crash.
Let's first look at the macro definition of vadefs. h In Windows:
# Elif defined (_ m_ix86) # DEFINE _ intsizeof (N) (sizeof (n) + sizeof (INT)-1 )&~ (Sizeof (INT)-1) # DEFINE _ crt_va_start (AP, V) (AP = (va_list) _ addressof (v) + _ intsizeof (v )) # DEFINE _ crt_va_arg (AP, t) (* (T *) (AP + = _ intsizeof (t)-_ intsizeof (t ))) # DEFINE _ crt_va_end (AP) (AP = (va_list) 0)
Linux.
Why is there a problem with the above two statements in Linux? Haha, the compilation still looks good at the prompts and warning information
"'Short unsigned int' is promoted to 'int' when passed through '...'"
"'Char 'is promoted to 'int' when passed through'... '" // when passing the char type, it will be upgraded to the int type.