I know about RAII and BS's response to previous requests, but I'd really
love to see 'finally' available in C++ exception handling. Yes, we can
live without 'finally' but it means a bit more typing (more classes) for
simple scenarios (like calling LeaveCriticalSe ction() before a function
returns). It would also make porting other languages to C++ a bit more
simple.
Another thing I'd like to see is a 'reentrant' keyword that can be
applied to functions and methods. The compiler should have all the info
necessary to complain when a non-reentrant function is labeled as reentrant. 21 1441
J. Smith wrote: Another thing I'd like to see is a 'reentrant' keyword that can be applied to functions and methods. The compiler should have all the info necessary to complain when a non-reentrant function is labeled as reentrant.
So how would the compiler identify a non-reentrant function?
--
Joe Seigh
When you get lemons, you make lemonade.
When you get hardware, you make software.
Joe Seigh wrote: J. Smith wrote: Another thing I'd like to see is a 'reentrant' keyword that can be applied to functions and methods. The compiler should have all the info necessary to complain when a non-reentrant function is labeled as reentrant.
So how would the compiler identify a non-reentrant function?
It uses no static or global variables. But a new keyword is
'disproportiona te'.
J. Smith wrote: I know about RAII and BS's response to previous requests, but I'd really love to see 'finally' available in C++ exception handling.
You probably don't know (enough) about RAII. Otherwise you wouldn't
want a 'finally'.
Joe Seigh wrote: J. Smith wrote:
Another thing I'd like to see is a 'reentrant' keyword that can be applied to functions and methods. The compiler should have all the info necessary to complain when a non-reentrant function is labeled as reentrant.
So how would the compiler identify a non-reentrant function?
Use of a non-local object maybe?
Ian
On 2005-07-17 00:08:31 +0100, "Mercator" <me********@spa mbob.com> said: Joe Seigh wrote: J. Smith wrote: Another thing I'd like to see is a 'reentrant' keyword that can be applied to functions and methods. The compiler should have all the info necessary to complain when a non-reentrant function is labeled as reentrant. So how would the compiler identify a non-reentrant function?
It uses no static or global variables.
.... And only calls functions themselves labelled as "reentrant" ...
.... And doesn't dereference any pointer ...
file super_safe.cpp
void f(int *p) reentrant {
*p = 0 ;
}
file subvert_it_anyw ay.cpp
int global ;
int main() {
f(&global) ;
return 0 ;
}
But a new keyword is 'disproportiona te'.
.... or the idea, itself, inappropriate ? :)
but I'd really love to see 'finally' available in C++ exception handling.
That one seems more readily implementable, but C++ politics will
probably vote it down :(
--
JFB
On 2005-07-17 00:10:43 +0100, "Mercator" <me********@spa mbob.com> said: J. Smith wrote: I know about RAII and BS's response to previous requests, but I'd really love to see 'finally' available in C++ exception handling.
You probably don't know (enough) about RAII. Otherwise you wouldn't want a 'finally'.
You probably don't know (enough) about finally. Otherwise you would
see RAII as just a special hackish case of the more general finally
construct.
--
JFB
> You probably don't know (enough) about finally. Otherwise you would see RAII as just a special hackish case of the more general finally construct. -- JFB
Ok, fair to say, RAII binds to class, and finally block binds to procedure.
If you are lazy designing proper classes, you'd want finally. If you are
doing a huge project, where a lot of classes and procedures are concerned,
binding to classes is instantaneous.
Regards,
Ben
On 2005-07-17 01:56:00 +0100, "benben" <be******@hotma il.com> said: You probably don't know (enough) about finally. Otherwise you would see RAII as just a special hackish case of the more general finally construct.
Ok, fair to say, RAII binds to class, and finally block binds to procedure. If you are lazy designing proper classes, you'd want finally. If you are doing a huge project, where a lot of classes and procedures are concerned, binding to classes is instantaneous.
How so ?!?! Instantenous??? ?
in a finally block, you only have to clean-up whatever it is
that needs cleaning, whether _you_ acquired it or not.
With RAII, not only do you _have to_ define extra classes, but
also cope with the communication between the point you're about
to (re) throw and the said class(es) to deal with the case that
the "resource" that wasn't for you to acquire in the first place,
nor to release in nornal circumstances, are for you to release
in the exceptional case.
--
JFB
"verec" <ve***@mac.co m> wrote in message
news:42******** *************** @news.aaisp.net .uk... On 2005-07-17 01:56:00 +0100, "benben" <be******@hotma il.com> said:
You probably don't know (enough) about finally. Otherwise you would see RAII as just a special hackish case of the more general finally construct.
Ok, fair to say, RAII binds to class, and finally block binds to
procedure. If you are lazy designing proper classes, you'd want finally. If you are doing a huge project, where a lot of classes and procedures are
concerned, binding to classes is instantaneous.
How so ?!?! Instantenous??? ?
in a finally block, you only have to clean-up whatever it is that needs cleaning, whether _you_ acquired it or not.
With RAII, not only do you _have to_ define extra classes, but also cope with the communication between the point you're about to (re) throw and the said class(es) to deal with the case that the "resource" that wasn't for you to acquire in the first place, nor to release in nornal circumstances, are for you to release in the exceptional case. -- JFB
With good design, all clean ups are affiliated with a class.
Let's say we have a huge project in which finally blocks are intensively
used. Class A is one of many classes the project consists of. Now you are
asked to update A's implementation and the change requires a differently
clean up scheme. You now face a large number of finally blocks needed to be
rewritten.
On the other hand, had all the necessary clean up operations encapsulated by
class A, we only have to update the clean up code once, inside A. RAII will
take care of everything else.
Regards,
Ben This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: =?ISO-8859-15?Q?Markus_M=FCller-Olm?= |
last post by:
===============================================================================
------------------- CALL FOR PAPERS -------------------
VMCAI 2009
The Tenth International Conference on
Verification, Model Checking, and Abstract Interpretation
|
by: UDBDBA |
last post by:
Hello All,
I am with IDUG North America 2009 Conference Planning Committee. The
"Call for Speaker" deadline is today, Sept 8th 2008. We would like to
make sure you have the information to submit your abstract. Your
participation as a speaker is another way of volunteering and
supporting the ever-growing IDUG Community. I hope that you would take
sometime in submitting your presentation abstracts using the link
below.
|
by: Aahz |
last post by:
Call for proposals -- PyCon 2009 -- <http://us.pycon.org/2009/>
===============================================================
Want to share your experience and expertise? PyCon 2009 is looking for
proposals to fill the formal presentation tracks. The PyCon conference
days will be March 27-29, 2009 in Chicago, Illinois, preceded by the
tutorial days (March 25-26), and followed by four days of development
sprints (March 30-April 2).
...
|
by: Douglas Napoleone |
last post by:
We should get an announcement out on the blog:
http://pycon.blogspot.com/
and note that the deadline is approaching for both talks and tutorials.
For some reason blogger does not like my google account, so I cant
seem to do it :-(
-Doug
|
by: Mark Lutz |
last post by:
A page describing our 2009 Python class offerings has just
been posted here:
http://home.earthlink.net/~python-training/2009-public-classes.htm
The first class in 2009 will be held January 27-30 in
Colorado, and is now open for enrollments.
These are public classes, open to individuals. They provide
in-depth and hands-on introductions to Python and its common
| |
by: Biswajyoti Pal |
last post by:
IIT Kharagpur
KSHITIJ 2009
THE ANNUAL TECHNO-MANAGEMENT FEST
29th Jan- 1st Feb
THE OVERNITE ACM ICPC 2009 MULTI PROVINCIAL PROGRAMMING CONTEST
( http://overnite.ktj.in )
|
by: dlite922 |
last post by:
I'm not sure if it's a bug or maybe some weird way strtotime() works, but I need dates for
1. Second Sunday of March
2. First Sunday of November
for any given year (mostly current year).
This
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
|
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...
|
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...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
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...
| |