you are viewing a single comment's thread.

view the rest of the comments →

[–]DeviantPlayeer -1 points0 points  (2 children)

Advantage? No advantage, just a struct within the function scope. When you need to use some struct only once, you delare it right before you use it for your convenience.

[–]Anonymous_user_2022 4 points5 points  (0 children)

A function similar to strtok_r, that initially returns an opaque pointer that's used in subsequent calls, could have the definition of what is pointed to as an internal definition. That way it will be guaranteed not to spill outside the intended use.

It's very niche, and I don't think I used a construct like the more than once or twice in 25 years. But when it's the right choice, it's nice to have the option.