News for hackers. Stuff that matters.
Re:What is “:-!!” in C code? by takeda on Monday November 21, 2016 @01:21AM (#13003566)
I'm not sure that macro in this submission shows that Go is better.

Neither Go nor C has static assertions, the macro in questions uses clever techniques to implement one in C, but you probably can't do that in Go. So C is more powerful here.

Another example of clever C macro use is implementation of foreach loop (C doesn't have foreach) in linux kernel, here's question about it:

http://stackoverflow.com/questions/15754236/how-do-i-use-the...

Re:What is “:-!!” in C code? by OJFord on Monday November 21, 2016 @02:29AM (#13003790)

    > Neither Go nor C has static assertions
C11 has:

    _Static_assert(const_expr, fail_string)
Re:What is “:-!!” in C code? by takeda on Monday November 21, 2016 @12:16PM (#13007026)
Ha, looks like my C knowledge is a bit outdated.

I haven't really used C after I graduated and I remember my professor showing us how to implement static assertion :)