Why dont RealTime Embedded programmers use Exception Handling?
I have seen at several places that C++ programmers writing for RealTime
Embedded applications dont use Exception Handling. They dont like
Throw/catch concept. WHY?
Re: Why dont RealTime Embedded programmers use Exception Handling?
On 2006-07-17, NewToEmbeddedLinux <hetzme@yahoo.com> wrote:
[color=blue]
> I have seen at several places that C++ programmers writing for
> RealTime Embedded applications dont use Exception Handling.
> They dont like Throw/catch concept. WHY?[/color]
The concept is fine.
The way it's implemented in C++ makes it difficult to avoid
pitfalls like memory leaks and just plain being a memory hog.
--
Grant Edwards grante Yow! - if it GLISTENS,
at gobble it!!
visi.com
Re: Why dont RealTime Embedded programmers use Exception Handling?
"NewToEmbeddedLinux" <hetzme@yahoo.com> wrote in message
news:1153169211.280510.318220@m79g2000cwm.googlegroups.com...[color=blue]
> I have seen at several places that C++ programmers writing for RealTime
> Embedded applications dont use Exception Handling. They dont like
> Throw/catch concept. WHY?[/color]
Exception handling in C++ is often implemented with table searches and
stack-frame walking. The time taken to process an exception can be large
even for user initiated exceptions (throw), while exceptions driven by
hardware (access violation, FPU) have additional overheads. So, if the
exception only occurs in non-RT part of the application then all is well but
otherwise...
Peter
Re: Why dont RealTime Embedded programmers use Exception Handling?
Peter:
How does the implementation with table searches and stack-frame walking
decrease the performance?
How do we catch the exceptions driven by the hardware? the C++
exception are caught if exceptions are thown.. right?
Thanks.
Peter Dickerson wrote:[color=blue]
> "NewToEmbeddedLinux" <hetzme@yahoo.com> wrote in message
> news:1153169211.280510.318220@m79g2000cwm.googlegroups.com...[color=green]
> > I have seen at several places that C++ programmers writing for RealTime
> > Embedded applications dont use Exception Handling. They dont like
> > Throw/catch concept. WHY?[/color]
>
> Exception handling in C++ is often implemented with table searches and
> stack-frame walking. The time taken to process an exception can be large
> even for user initiated exceptions (throw), while exceptions driven by
> hardware (access violation, FPU) have additional overheads. So, if the
> exception only occurs in non-RT part of the application then all is well but
> otherwise...
>
> Peter[/color]
Re: Why dont RealTime Embedded programmers use Exception Handling?
On 2006-07-18, NewToEmbeddedLinux <hetzme@yahoo.com> wrote:
[color=blue]
> How does the implementation with table searches and
> stack-frame walking decrease the performance?[/color]
Compared to _not_doing_ table searches and stack-frame walking,
_doing_ them takes a lot of time.
[color=blue]
> How do we catch the exceptions driven by the hardware?[/color]
You mean interrupts? The hardware causes an ISR to be called.
[color=blue]
> the C++ exception are caught if exceptions are thown.. right?[/color]
I suppose so, unless your compiler and runtime library are
broken.
I've also been told by C++ experts that exceptions, when
combined with some other features you get almost unavoidable
memory leaks. I don't remember the exact combinations, and the
"experts" may have been wrong, but IMO C++ is sufficiently
opaque that usage of anything other than a carefully screened
subset of it's features is just too dangerous.
[Yes, I think that's true for general purpose applications
programming as well.]
--
Grant Edwards grante Yow! If elected, Zippy
at pledges to each and every
visi.com American a 55-year-old
houseboy...