Elektrine lite

← Feed

@Steel_Virgin@eldritch.cafe

Post #1981518

2026-05-04 10:24 UTC

@typeswitch ok now I just have no idea what ## are. it feels cool. I wanna learn this. but it feels like nobody would want me to use this in a company the same way they didn't want me to do nested list comprehensions in python… or ternary operators in C. Or anything that you would need to know the langage specificaly to understand the code (basicaly mister boss wants to be able to believe he could have done it himself 😔)

Replies (1)

  • @typeswitch@gamedev.lgbt 2026-05-04 12:23

    @Steel_Virgin It's a way to create new identifiers from arguments. In a macro, x##y is a way to concatenate the x and y tokens. So if for example x is a macro argument and y isn't, let's say we passed in foo for x, then x##y would become fooy. If y is a macro argument as well, e.g. bar, it also gets replaced, e.g. x##y becomes the single token foobar. This is useful for macro programming but it's also terrible 🙃

    Open ##1981519