Announcement

Collapse
No announcement yet.

Fedora 29 Might Make Change To Eliminate Unnecessary Linking

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Originally posted by F.Ultra View Post
    Well that really does make no sense, in fact every C compiler must already support an internal norestrict since "char *" and "unsigned char *" are allowed to alias any other pointer according to the specifications and thus are already hardwired to be norestrict. restrict however might introduce some headache in a C++ world with all the overloading etc that they do there but I cannot make any informed opinion there since I'm not a C++ programmer and know far too little of the language.
    restrict is a so-called "top level" qualifier in most cases, so overloading doesn't really apply.

    Top-level means stuff like "const int", which applies to the type itself, unlike "const int*" which applies to what it points to. A top-level constant pointer is "int* const" in this case. Such top-level qualifiers cannot be overloaded against, so you can't overload based on "int*" and "int* const". Same with restrict (restrict applies to the pointer, not to what it points to).

    Even in C you can define new types, with struct (C++ is much more powerful here though), so even a C compiler has to disambiguate this way anyway (not for overloading, but the type-based alias analysis needs to be able to handle "custom types").

    Note that "may_alias" attribute applies to the underlying type, confusingly. Don't know why, lol. So you need to apply it to the "int" in the previous case, not to the pointer!

    Comment

    Working...
    X