-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed as not planned
Labels
cclangClang issues not falling into any other categoryClang issues not falling into any other categoryenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featurewontfixIssue is real, but we can't or won't fix it. Not invalidIssue is real, but we can't or won't fix it. Not invalid
Description
I'd like to propose adding reference to C as an clang extension. The same one C++ has.
A reference, like a pointer, stores the address of an object that is located elsewhere in memory. Unlike a pointer, a reference after it's initialized can't be made to refer to a different object or set to null. There are two kinds of references: lvalue references, which refer to a named variable and rvalue references, which refer to a temporary object. The
&operator signifies an lvalue reference and the&&operator signifies either an rvalue reference, or a universal reference (either rvalue or lvalue) depending on the context.
https://learn.microsoft.com/en-us/cpp/cpp/references-cpp
int main() {
int i; // Declare the object.
int& ref = i; // Declare and initialize the reference.
ref = 5;
printf("%i\n", i); // "5"
}Metadata
Metadata
Assignees
Labels
cclangClang issues not falling into any other categoryClang issues not falling into any other categoryenhancementImproving things as opposed to bug fixing, e.g. new or missing featureImproving things as opposed to bug fixing, e.g. new or missing featurewontfixIssue is real, but we can't or won't fix it. Not invalidIssue is real, but we can't or won't fix it. Not invalid