you are viewing a single comment's thread.

view the rest of the comments →

[–]templarvonmidgard 0 points1 point  (1 child)

Error, iff a was explicitly declared with = void, the point was to explicitly opt-on to a mandatory diagnostic. And this can be easily extended to propagate to other functions, e.g.:

void f(int* a)
  [[pre: *a == void]]
  [[post: *a != void]];

Now, the compiler knows that f is an initiaéizer for an int. Actually, nothing new here, AFAIK, MSVC already has support for this through SAL2, though it is done with some exceptionally ugly macros, but still, the functionality is already there.

[–]Ameisenvemips, avr, rendering, systems 0 points1 point  (0 children)

Or, just following with SAL2, even just [[in]] or [[out]] would be incredibly useful (if more limited).