-1

Thanks to this question I understand what this construct does and how it can be used.

What I don't get is why is it missing from C++? Does it conflict with another feature? Was it replaced with something better? Does the standard say anything about this?

Community
  • 1
  • 1
user1233963
  • 1,450
  • 15
  • 41

1 Answers1

2

C++ was standardized before this feature was standard in C. There is no general process of migrating new C features to C++, although some are on a case-by-case basis.

You aren't really expected to do this in C++. If you think you want to pass a pointer to the first element of an array you can instead pass either a vector by reference, or pass one or a pair of iterators. That is to say: don't try to decorate raw pointers, instead browse C++'s vast menu of types.

Presumably it would be useful when writing dual-language header files, if C++ supported all the declaration syntax that C supports. I haven't done that in a long time, though, so I don't know what the best alternative is. You'd probably get away with just declaring it as a char* in the C++ header, but I'm not sure whether that conforms to standards.

Steve Jessop
  • 273,490
  • 39
  • 460
  • 699