Monday, December 23, 2013

passing null as parameter to reference to an object

Newsgroup: comp.lang.c++

Subject: passing null as parameter to reference to an object

From: shaan <shaanxxx@...>

Date: Mon, 23 Dec 2013 02:51:56 -0800 (PST)



I have following function:

void myfunction (int &a , bool g )

{

if(g)

{

int k = a;

}

}





int main()

{

int * ptr = NULL;

myfunction(*ptr, false);



}



Is passing null to a reference legal? What standard has to say about this ?







via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?157612-passing-null-as-parameter-to-reference-to-an-object&goto=newpost

View all the progranning help forums at:

http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums

No comments:

Post a Comment