2,466 karma · joined August 27, 2016
https://tbodt.com hnchat.com:C8Lt0S6VoYSJX6n5htYy
git tag --contains <commit>
or git branch --contains <commit>> It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.
int things[max(size1, size2)];
and there's been recently a push to remove all VLAs (arrays with non constant size) from the kernel. The -Wvla flag was warning about these arrays even though they're actually constant size, so something needed to be done. foo() > bar() ? foo() : bar()
can have a different result than int __x = foo();
int __y = bar();
__x > __y ? __x : __y #define __is_constant(x) \
(sizeof(int) == sizeof(*(1 ? ((void*)((long)(x) * 0l)) : (int*)1)))
If x is a compile-time constant, (void* )((long)(x) * 0l) is equivalent to NULL, otherwise it's just a regular void* . And if both sides of a ternary are pointers, the rule is:If one side is NULL, the type of the ternary should be the type of the other side (int* in this case).
Otherwise, if one side is a void* , the type of the ternary should be void* .
So if x is constant, the type of the ternary is int* , and if it's not constant the type is void* . The sizeof(* ()) around it turns that into sizeof(int) or sizeof(void), and in the GNU dialect sizeof(void) is 1, which is different from sizeof(int). Whew.
What I want to know is what's wrong with __builtin_constant_p.
Do you have your streamer program posted on GitHub or something? I want it.
PyObject *fout = _PySys_GetObjectId(&PyId_stdout);
stdout_encoding = _PyObject_GetAttrId(fout, &PyId_encoding);
The python equivalent of this is `sys.stdout.encoding`. The StringIO object was constructed without an encoding, so this is None. stdout_encoding_str = PyUnicode_AsUTF8(stdout_encoding);
This tries to convert None to a C string, which fails.