r/ProgrammerHumor • • 22d ago

Meme poohWritesCpp

Post image
949 Upvotes

95 comments sorted by

View all comments

Show parent comment

4

u/conundorum 20d ago

Different people like different distinctions, basically. To some people, this nicely differentiates between initialisation & assignment. But to others, it's an abomination that lies about being a compound object (aggregate/list/array/etc.) when it really, really isn't.

Especially since int a = {10}; is also a thing, and has a different meaning than either of those.

2

u/Big-Rub9545 20d ago

These are often just forced aesthetic views with no proper backing. Another way to instead look at braces is initialization syntax sugar, where the values enclosed in braces are processed in total to construct an object. For compound types, those values would be field values; for arrays, element values; for primitive values, their direct initializers.

Everyone can keep their own style preferences but most of these hard lines are just people (who often don’t like the language to begin with) making weird dictates with vague reasoning.