Click here to Skip to main content
13,798,454 members

C / C++ / MFC

 
QuestionMessage Closed Pin
26-May-18 7:27
memberben lewis26-May-18 7:27 
QuestionGraphical representation of Data Pin
sree7926-May-18 2:09
membersree7926-May-18 2:09 
AnswerRe: Graphical representation of Data Pin
Richard MacCutchan26-May-18 3:41
protectorRichard MacCutchan26-May-18 3:41 
GeneralMessage Closed Pin
26-May-18 7:24
memberben lewis26-May-18 7:24 
GeneralMessage Closed Pin
26-May-18 7:26
memberben lewis26-May-18 7:26 
AnswerRe: Graphical representation of Data Pin
leon de boer26-May-18 6:09
memberleon de boer26-May-18 6:09 
GeneralRe: Graphical representation of Data Pin
sree7927-May-18 18:44
membersree7927-May-18 18:44 
Questionvolatile issue - repost Pin
Vaclav_22-May-18 6:24
memberVaclav_22-May-18 6:24 
<b>I am reposting this in an attempt to focus on the issue.
THIS IS NOT A BUMP! ( I know better ) </b>

I am well aware what volatile keyword does.

In my application it prevents accidental access to memory AKA RPi hardware.

The task is to map the hardware to memory. It works just fine resulting in "base" pointer to memory map.
Now I need to add specific offset to the "base" and have the "result" to be of volatile type.
The included snippet of test code does that with ONE exception - no matter what combination of code I use I cannot achieve VALID <b>volatile</b> result.
It only works when no volatile keyword is used , none at all.

I did try casts and dynamic_cast.

I have optimizer turned off and obviously doing something wrong applying pointers.
This code test snippet is located in main(), no other code is involved.
It gives pointer to "base" ( value is irrelevant) and adds "int" offset and produces new "result" pointer.

<pre lang="c++">
int *base;
int offset = 1;
int *result;
result = base + offset;
</pre>

Any help will be greatly appreciated.
Cheers
Vaclav
QuestionRe: volatile issue - repost Pin
Richard MacCutchan22-May-18 9:26
protectorRichard MacCutchan22-May-18 9:26 
AnswerRe: volatile issue - repost Pin
CPallini22-May-18 11:11
mvpCPallini22-May-18 11:11 
AnswerRe: volatile issue - repost Pin
leon de boer22-May-18 20:12
memberleon de boer22-May-18 20:12 
GeneralRe: volatile issue - repost Pin
CPallini22-May-18 22:39
mvpCPallini22-May-18 22:39 
QuestionRe: volatile issue - repost Pin
CPallini22-May-18 11:11
mvpCPallini22-May-18 11:11 
AnswerRe: volatile issue - repost Pin
Vaclav_22-May-18 12:54
memberVaclav_22-May-18 12:54 
GeneralRe: volatile issue - repost Pin
leon de boer22-May-18 16:44
memberleon de boer22-May-18 16:44 
GeneralRe: volatile issue - repost Pin
Vaclav_22-May-18 18:44
memberVaclav_22-May-18 18:44 
GeneralRe: volatile issue - repost Pin
leon de boer22-May-18 19:13
memberleon de boer22-May-18 19:13 
GeneralRe: volatile issue - repost SOLVED Pin
Vaclav_23-May-18 4:17
memberVaclav_23-May-18 4:17 
QuestionRe: volatile issue - repost SOLVED Pin
CPallini23-May-18 4:28
mvpCPallini23-May-18 4:28 
GeneralRe: volatile issue - repost SOLVED Pin
Richard MacCutchan23-May-18 4:32
protectorRichard MacCutchan23-May-18 4:32 
GeneralRe: volatile issue - repost SOLVED Pin
Peter_in_278023-May-18 4:44
professionalPeter_in_278023-May-18 4:44 
GeneralRe: volatile issue - repost SOLVED Pin
leon de boer23-May-18 7:55
memberleon de boer23-May-18 7:55 
GeneralRe: volatile issue - repost SOLVED Pin
Vaclav_24-May-18 6:53
memberVaclav_24-May-18 6:53 
GeneralRe: volatile issue - repost SOLVED Pin
supercat931-May-18 13:48
membersupercat931-May-18 13:48 
GeneralRe: volatile issue - repost SOLVED Pin
leon de boer4-Jun-18 22:05
memberleon de boer4-Jun-18 22:05 

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
Web06 | 2.8.181207.3 | Last Updated 13 Dec 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid