You think you have a reasonable grasp on C, then someone goes and writes:

[0x00 ... 0x17] = &&l_int

and you're like ???

(from https://github.com/quartzjer/cb0r/blob/master/src/cb0r.c)

cb0r/src/cb0r.c at master · quartzjer/cb0r

Minimal Zero-Footprint CBOR Decoder in C. Contribute to quartzjer/cb0r development by creating an account on GitHub.

GitHub
@ve7fim What the blue bollocking shit biscuits is this?

@mos_8502

After looking at it a little longer, I think they're creating a jump table using labels, but yikes!

I have a list of C features that when I see them, I pretty much know that I need to find something else or re-write it from scratch. That code added a few new ones to my list.

@ve7fim For me that's Duff's Device: It's impressive, I understand how it does what it does and why it's been used, but I don't think there's any reason to use it myself, because every compiler I use can unroll loops for me.

@ve7fim @mos_8502

That &&label; syntax is a gcc extension for computed labels thouhg. https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html

Labels as Values (Using the GNU Compiler Collection (GCC))

Labels as Values (Using the GNU Compiler Collection (GCC))

@ve7fim @mos_8502 there is no alternative to this syntax if you want a certain level of performance. no one uses this to be cute

@whitequark @mos_8502

:nods.

I think I've just been burned too many times by code that uses esoteric/advanced features when they were not needed.

So I tend to avoid them until I have learned how they work and when and where they should be used.

Playing with things I don't understand can lead me into dangerous places.

@ve7fim the code disables 4 GCC warnings before getting to that wonky code. As a C developer myself, having to do that would be a sign I’m doing something unnecessarily complicated and oblique.