Compiler and programming language engineer. Contributor to LLVM, Clang, Swift, Move, and Mojo. He/Him.

New York, USA
Joined September 2010
Do people consider Tim Cook a celebrity? He killed my entire family
Has a celebrity ever been rude to you??
1
8
3,577
when you people dare review my code
11
1,287
AFAICT, another C disagreement between Clang (error diagnostic) and GCC (no diagnostic): C18 6.7.5p8, "if the definition of an object has an alignment specifier, any other declaration of that object shall either specify equivalent alignment or have no alignment specifier."
1
4
I may have found another bit of C that GCC 10.2 and Clang 11.0.0 can't agree on. C18 6.7.5 "an alignment specifier shall appear only in [...] the type name of a compound literal," but Clang's parser can't handle it if it comes immediately after the lparen. godbolt.org/z/hqxvnT
1
4
I guess more than a "disagreement" on syntax, this is really just an inconsequential bug in the Clang parser. Any user of the compiler can work around this by moving their alignment-specifier past the type-specifier that must also exist in the compound-literal type-name.
1
You know you have a true 10x developer when they're churning out thousands upon thousands of lines of bare-metal, performant C code, and still hitting 100% test coverage godbolt.org/z/Tb4abb
2
1
14
Harnessing the full power of C constant expressions like this, with the express purpose of meeting a corporate performance review benchmark for "lines of code committed," is an advanced programming technique that's known as "compile-time meta-programming"
4
GCC 10.2 and Clang 11 just can't agree on whether you can put a C18 '_Static_assert' in a 'for' loop. GCC says sure, Clang says no way. godbolt.org/z/e8EEYM
5
Brian Gesiak retweeted
One of my hot takes these days is that, if I made my own language, I don't think I would allow identifiers to be shadowed. In C in particular, it seems to enable some very strange semantics.
C is wild. Both GCC and Clang will tell you that you can't assign to 'struct s *' with a value of type 'struct s *'. What the messages don't convey is that the tag 's' refers to a different struct type based on the scopes of 'p' and 'v'. 1/
1
1
3
Never really read the C standard very closely before, but here's some fun trivia: in 'if' statements, both the body and the statement itself have their own scope. So you can define 'struct s' and then shadow it twice, all in one 'if' statement, without a compound-statement.
5
1
20
This is, of course, extremely practical information that you can use in your production systems TODAY
1
15
Probably one of the most efficient movers for millennials escaping to the suburbs with a collection of homogeneous objects that don't provide a copy constructor
1
15
Some interesting stuff going on here! * C18 6.6p10: A C compiler may treat any expression as a constant expression. * C18 6.7.6.2p5: Array with a non-constant size expression is a VLA. * C18 6.5.3.4p2: 'sizeof' only evaluates its operand if it's a VLA.
This Post is from an account that no longer exists. Learn more
2
8
👋
17
Happy Adopt-a-versary to our wonderful pup, Ellie! 2 years ago when we first met, you were scared and had rashes all over. Now you're healthy and happy as a clam!
1
23
The adoption agency used Facebook to share this photo of us adopting Ellie. We were their 1000th adoption of 2018. Ellie looks so sad!! 😭 I'm glad she's happier now, in her new home ❤️
11
It seems odd to me that C standardizes the 'offsetof' macro to take a 'member-designator' as its second operand, and that grammar element is never defined, AFAICT. GNU C documents it as having slightly different syntax than the standardized 'designator-list', which seems awkward.
1
1
2
I mean I guess the syntax for member-designator is defined in terms of "'&(t.<member-designator>)' should be an address constant," but it seems to me that in an ideal world with more uniform syntax, the second operand would be a designator-list instead.
In C a struct declaration is just a type-specifier, and the grammar allows type-specifiers in all sorts of fun and exciting places: // Define 'struct str' within cast-expression: void *p = (struct str { char *data; size_t length; } *)0; // Use it: struct str s;
1
1
11
char s1[2]; // constant array char[2] char s2[1 + 1]; // also char[2] char s3[(int)2.f]; // also char[2] char s4[(int)(1 + 1)]; // also char[2] char s5[(int)(1.f + 1)]; // variable-length array of char
1
8