Click here to Skip to main content
15,887,267 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
SuggestionRe: how to correct an segmentation fault ? Pin
Richard MacCutchan26-May-18 21:10
mveRichard MacCutchan26-May-18 21:10 
AnswerRe: how to correct an segmentation fault ? Pin
CPallini29-May-18 0:01
mveCPallini29-May-18 0:01 
GeneralRe: how to correct an segmentation fault ? Pin
Tarun Jha5-Jun-18 1:50
Tarun Jha5-Jun-18 1:50 
QuestionGraphical representation of Data Pin
sree7926-May-18 1:09
sree7926-May-18 1:09 
AnswerRe: Graphical representation of Data Pin
Richard MacCutchan26-May-18 2:41
mveRichard MacCutchan26-May-18 2:41 
AnswerRe: Graphical representation of Data Pin
leon de boer26-May-18 5:09
leon de boer26-May-18 5:09 
GeneralRe: Graphical representation of Data Pin
sree7927-May-18 17:44
sree7927-May-18 17:44 
Questionvolatile issue - repost Pin
Vaclav_22-May-18 5:24
Vaclav_22-May-18 5: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 8:26
mveRichard MacCutchan22-May-18 8:26 
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
leon 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
Vaclav_22-May-18 11:54 
GeneralRe: volatile issue - repost Pin
leon de boer22-May-18 15:44
leon de boer22-May-18 15:44 
GeneralRe: volatile issue - repost Pin
Vaclav_22-May-18 17:44
Vaclav_22-May-18 17:44 
GeneralRe: volatile issue - repost Pin
leon de boer22-May-18 18:13
leon de boer22-May-18 18:13 
GeneralRe: volatile issue - repost SOLVED Pin
Vaclav_23-May-18 3:17
Vaclav_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
mveRichard 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
leon de boer23-May-18 6:55 
GeneralRe: volatile issue - repost SOLVED Pin
Vaclav_24-May-18 5:53
Vaclav_24-May-18 5:53 
GeneralRe: volatile issue - repost SOLVED Pin
supercat931-May-18 12:48
supercat931-May-18 12:48 
GeneralRe: volatile issue - repost SOLVED Pin
leon de boer4-Jun-18 21:05
leon de boer4-Jun-18 21: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.