Click here to Skip to main content
14,122,675 members

C / C++ / MFC

 
AnswerRe: volatile issue - repost Pin
CPallini22-May-18 10:11
mveCPallini22-May-18 10:11 
AnswerRe: volatile issue - repost Pin
leon de boer22-May-18 19:12
memberleon de boer22-May-18 19:12 
GeneralRe: volatile issue - repost Pin
CPallini22-May-18 21:39
mveCPallini22-May-18 21:39 
QuestionRe: volatile issue - repost Pin
CPallini22-May-18 10:11
mveCPallini22-May-18 10:11 
AnswerRe: volatile issue - repost Pin
Vaclav_22-May-18 11:54
memberVaclav_22-May-18 11:54 
GeneralRe: volatile issue - repost Pin
leon de boer22-May-18 15:44
memberleon de boer22-May-18 15:44 
GeneralRe: volatile issue - repost Pin
Vaclav_22-May-18 17:44
memberVaclav_22-May-18 17:44 
GeneralRe: volatile issue - repost Pin
leon de boer22-May-18 18:13
memberleon de boer22-May-18 18:13 
That ostream object is a pile of overloaded functions on the operator <<
std::basic_ostream::operator<< - cppreference.com[^]

NOTE FROM ABOVE .. I underlined the statement parts:
Quote:
There are no overload for pointers to non-static member, pointers to volatile, or function pointers (other than the ones with signatures accepted by the (10-12) overloads). Attempting to output such objects invokes implicit conversion to bool, and, for any non-null pointer value, the value 1 is printed

I avoid the thing like the plague because you have to know it's behaviour .. so yes a non zero volatile pointer will always print as 1 .. it tells you that.

So the good news is there is nothing wrong with your compiler it is following the c++ standard.
If you don't like it take it up with the c++ standard comittee.

Ostream has other strange (but documented) filter behaviour.
For example with char* pointers it has a special overload expecting it to be a pointer to a null terminated string
cout << (char*)0x41 << endl;    // This will crash and burn .. it expects a null terminated string from a char*
cout << (void*)0x41 << endl;    // This will print fine

You could try putting a void* typecast so it goes thru the void* pointer overload ... like so should work
cout << "result " << (void*)result << '\n';

If you are intending to use ostream you will need to learn it's ins and outs and quirky behaviour.
Anyhow it's not a big issue and rolls around ostream behaviour .. so don't make it more than what it is.

Your pointers are clearly adding properly you were just having a display issue with ostream Smile | :)
In vino veritas


modified 23-May-18 1:08am.

GeneralRe: volatile issue - repost SOLVED Pin
Vaclav_23-May-18 3:17
memberVaclav_23-May-18 3:17 
QuestionRe: volatile issue - repost SOLVED Pin
CPallini23-May-18 3:28
mveCPallini23-May-18 3:28 
GeneralRe: volatile issue - repost SOLVED Pin
Richard MacCutchan23-May-18 3:32
protectorRichard MacCutchan23-May-18 3:32 
GeneralRe: volatile issue - repost SOLVED Pin
Peter_in_278023-May-18 3:44
professionalPeter_in_278023-May-18 3:44 
GeneralRe: volatile issue - repost SOLVED Pin
leon de boer23-May-18 6:55
memberleon de boer23-May-18 6:55 
GeneralRe: volatile issue - repost SOLVED Pin
Vaclav_24-May-18 5:53
memberVaclav_24-May-18 5:53 
GeneralRe: volatile issue - repost SOLVED Pin
supercat931-May-18 12:48
membersupercat931-May-18 12:48 
GeneralRe: volatile issue - repost SOLVED Pin
leon de boer4-Jun-18 21:05
memberleon de boer4-Jun-18 21:05 
GeneralRe: volatile issue - repost SOLVED Pin
supercat98-Jun-18 10:31
membersupercat98-Jun-18 10:31 
QuestionReturn a local 2d Array Pin
kinderu18-May-18 8:59
memberkinderu18-May-18 8:59 
AnswerRe: Return a local 2d Array Pin
Richard MacCutchan18-May-18 9:13
protectorRichard MacCutchan18-May-18 9:13 
GeneralRe: Return a local 2d Array Pin
kinderu18-May-18 9:45
memberkinderu18-May-18 9:45 
GeneralRe: Return a local 2d Array Pin
leon de boer18-May-18 16:34
memberleon de boer18-May-18 16:34 
GeneralRe: Return a local 2d Array Pin
Richard MacCutchan18-May-18 20:46
protectorRichard MacCutchan18-May-18 20:46 
AnswerRe: Return a local 2d Array Pin
jfbode102930-May-18 4:46
memberjfbode102930-May-18 4:46 
QuestionCan someone show me an example of including a DLL or function in a C program ? Pin
m3mb3r17-May-18 10:41
memberm3mb3r17-May-18 10:41 
SuggestionRe: Can someone show me an example of including a DLL or function in a C program ? Pin
Randor 17-May-18 11:52
professional Randor 17-May-18 11:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190518.1 | Last Updated 22 May 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid