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

C / C++ / MFC

 
AnswerRe: i would like to be a programmer Pin
jfbode102930-May-18 4:33
jfbode102930-May-18 4:33 
AnswerRe: i would like to be a programmer Pin
Vaclav_30-May-18 9:19
Vaclav_30-May-18 9:19 
AnswerRe: i would like to be a programmer Pin
Tarun Jha5-Jun-18 10:53
Tarun Jha5-Jun-18 10:53 
Questiontry /catch Exception missing type Pin
Vaclav_29-May-18 4:00
Vaclav_29-May-18 4:00 
AnswerRe: try /catch Exception missing type Pin
Jochen Arndt29-May-18 5:09
professionalJochen Arndt29-May-18 5:09 
AnswerRe: try /catch Exception missing type Pin
Richard MacCutchan29-May-18 5:12
mveRichard MacCutchan29-May-18 5:12 
AnswerRe: try /catch Exception missing type SOLVED Pin
Vaclav_30-May-18 9:06
Vaclav_30-May-18 9:06 
GeneralRe: try /catch Exception missing type SOLVED Pin
leon de boer30-May-18 16:25
leon de boer30-May-18 16:25 
This is a complex thing so lets go thru it.

On a Normal O/S, RTOS very few low level functions ever have exception catches they usually simply report it back. The why is simple, the problem it faces is how the exception should report the error, it isn't clear who it should be reported to the APP or the O/S.

As an example, early versions of Windows when low level functions raised an exception put up the blue screen of death and silly things on the API could create it.
Blue Screen of Death - Wikipedia[^]
It actually became a problem because people got sick of rebooting there computer and on the modern versions of windows it is reserved for unrecoverable errors.

Almost all the core windows API almost never raises an exception it simply passes the error back to be handled by the caller because part of being able to handle the error is to know what the caller program is which only the caller knows.

So basically there is no problem something like an APP raising exception it can rely on the O/S being able to do something sensible with the exception. However if the caller is something like a driver or the O/S itself there is always the problem the thing you are reporting to has already crashed. So in your case file I/O may well be used by a driver so no-one would set it up to raise an exception.

Now there are even newer changes in programming to Virtual O/S which started with VMware. There you have a hypervisor program and the O/S or OS's run above the hypervisor
Hypervisor - Wikipedia[^]
In that enviroment many low level functsions will raise an exception and the Hypervisor will catch them because it is immune to errors in the VM. So in that situation a file IO may well be setup to raise an exception.

See the common theme if you are going to raise an exception the thing that catches the exception must be able to continue running despite the error.
So the question of if a low level function should raise an exception depends on there being a stable level below it to catch the raised error.

What this answer brings in is the concept of protection rings the wiki entry is very Intel centric
Protection ring - Wikipedia[^]
You are mainly working on the Pi and on ARM processor they call it EXCEPTION LEVELS and we shorten it to EL. This is the setup on Pi3 which runs Cortexa53 cores it has EL0, EL1, EL2, EL3
CortexA-53 Exception Levels[^]

You will note they describe what parts of a system they expect to be running at what level
EL0 = Applications.
EL1 = OS kernel and associated functions that are typically described as privileged.
EL2 = Hypervisor.
EL3 = Secure monitor.

Now just to put that in perspective when you run your Raspbian linux it only uses EL0 & EL1 there is just a pass thru bootstub for EL2 & EL3 so you could say it doesn't use the CortexA53 to it's full capabilities. The reason why is that there are lots of processors out there that don't have it's protection level abilities and it would require a special version of linux to support it.

Now specifically in your case because you are writing code inside linux, your file i/o will be EL1 but your app will be EL0 ... there is a complex issue ... you are trying to make EL0 handle EL1 errors and it doesn't have the permissions to do so. It requires a very complex setup with callbacks that I won't go into unless you want.

Hopefully you see the answer to your question gets incredibly complex.
In vino veritas

Questionhow to correct an segmentation fault ? Pin
Tarun Jha26-May-18 11:55
Tarun Jha26-May-18 11:55 
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 
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 

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.