473,804 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exception from C function?

Hello everyone,
As far as I know, C function does not throw exception.

But Bjarne said in his book, section 14.8 Exception and Efficiency,

--------------------
In particular, an implementation knows that only a few standard C
library functions (such as atexit() and qsort()) can throw exceptions,
and it can take advantage of that fact to generate better code.
--------------------

What did he mean? C function could really throw exception? What
exception -- C++ exception or structured exception?
thanks in advance,
George
Jan 28 '08 #1
1 1406
George2 wrote:
As far as I know, C function does not throw exception.

But Bjarne said in his book, section 14.8 Exception and Efficiency,

--------------------
In particular, an implementation knows that only a few standard C
library functions (such as atexit() and qsort()) can throw exceptions,
and it can take advantage of that fact to generate better code.
--------------------

What did he mean? C function could really throw exception? What
exception -- C++ exception or structured exception?
There are no structured exceptions in C++ world (it's a MS Windows specific
thing), so Bjarne meant C++ exceptions.

atexit() and qsort() both take function pointers to callback function that
get called at some time and these functions could throw an exception. So
atexit() and qsort() can indirectly throw exceptions.

--
Thomas
http://www.netmeister.org/news/learn2quote.html
post tenebras lux. post fenestras tux.
Jan 28 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2724
by: StepH | last post by:
Hi, I've this module : from optparse import OptionParser import re _version = "P1" def writeVar(f, line):
1
1608
by: serge calderara | last post by:
Dear all, How can I handle correctly cascading exception? I generally use to catch exception ib all my function. This to identify each type the correct place that the exception occurs. What could happen is that if an exception occurs inside a function that call others function, it happend that I could get a never ending loop of exception routine calling other exception routines.
6
2140
by: Páll Ólafsson | last post by:
Hi I have a problem with the Microsoft.ApplicationBlocks.ExceptionManagement? I can't get it to work in RELEASE mode? If I run the project in debug mode the block works fine but when I run the exe file it doesn't catch any errors? Does anyone know what my problem might be? Regards
3
3506
by: Pierre Rouleau | last post by:
The std::exception class defined in the Standard C++ <exception> header specifies that the constructors could throw any exception becuase they do not have a throw() specification. Why is that? Is this because there could be an exception thrown when the code creates a std::exception? I would assume that is not the case. However, if I want to create a new exception class, derived from std::exception (say MyException) then how can I...
10
5004
by: linq936 | last post by:
Hi, I have many assert() call in my code, now I am considering to replace them with exception. The reason I want to do this change is that with the program going bigger and bigger, it is hard to test all the corner cases, and thus assert() does not work as good as before. The problem is if there are something really bad which was not captured by assert(), then in runtime, most likely the program will crash. This is the worst user...
6
4057
by: Steve Long | last post by:
Help, I'm running VS.NET 2003 and when I try to start my application, I get the "unhandled exception" dialog instead of the IDE highlighting the offending line of code. The problem appears to be instantiating a particular class in my project but the dialog doesn't tell me what code in the class is causing the problem (and it a large class). How can I get the IDE to take me to the offending line of code? If I put this line in my...
2
4957
by: Richard Collette | last post by:
Hi, I have a service, that runs perfectly when executed outside of the web service environment. When called as a web service I get the exception listed below sporadically. A call to the web method may succeed one time and not another. I cannot find any reason why it would work one time and not another. The exception occurs every two or three calls to the web method. The service utilizes a COM component provided by PeopleSoft...
1
3291
by: usenet | last post by:
I wrote some sample code (see below) for nested exception throwing i.e. my catch blocks are throwing exceptions of their own (for simplicity I used standard exceptions). I am getting some extraneous characters (St9) in my final output. Can anyone kindly help me interpret that please? Thanks, Ramesh
3
231
by: Allie | last post by:
Hi, all. I've never been any good at handling exceptions... So I need your help. Within a try{ } block, I have to call a function that has to throw its own exception. How should I go about doing this? try { checkNullHeader( sHeader, ref status );
1
3113
by: George2 | last post by:
Hello everyone, Such code segment is used to check whether function call or exception- handling mechanism runs out of memory first (written by Bjarne), void perverted() { try{
0
9593
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.