473,473 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

More on exception handling (Arnaud?)

It seems Arnaud was on target regarding the RTL inserting exception handling
routines. Here's another oddball occurrence on which I hope someone can shed
some light.

My EVENT struct is declared in a header file. If without making any source
changes, I move the definition of it constructor (shown below) from one source
(CPP) file to another, I get the same (apparently) 6144 byte increase in the
size of my target DLL. The same happens if I move the destrustor along with it
but does not happen if I move the destructor alone. Thanks!

EVENT::EVENT(HANDLE new_h, WCHAR* new_id, BOOL bAuto, BOOL bTemp)
{
h = new_h;
lstrcpy(id, new_id);
bTemporary = bTemp;
bAutoReset = bAuto;
dwEventCount += 1;
// linked list stuff below; add new EVENT at the end
pNextEvent = NULL;
if ( pLastEvent )
{
pLastEvent->pNextEvent = this;
pPrevEvent = pLastEvent;
}
else
{
pPrevEvent = NULL;
pFirstEvent = this;
}
pLastEvent = this;
}
--
- Vince
Dec 17 '06 #1
3 1055

"Vincent Fatica" <ab***@localhost.comwrote in message
news:45********@news.vefatica.net...
It seems Arnaud was on target regarding the RTL inserting exception
handling
routines. Here's another oddball occurrence on which I hope someone can
shed
some light.

My EVENT struct is declared in a header file. If without making any
source
changes, I move the definition of it constructor (shown below) from one
source
(CPP) file to another, I get the same (apparently) 6144 byte increase in
the
size of my target DLL. The same happens if I move the destrustor along
with it
but does not happen if I move the destructor alone. Thanks!
That shouldn't happen if you turn on "Whole Program Optimization". When
both functions are visible to the compiler at the same time, it can optimize
cleanup in the case of exceptions, and avoid generating the extra code.
>
EVENT::EVENT(HANDLE new_h, WCHAR* new_id, BOOL bAuto, BOOL bTemp)
{
h = new_h;
lstrcpy(id, new_id);
bTemporary = bTemp;
bAutoReset = bAuto;
dwEventCount += 1;
// linked list stuff below; add new EVENT at the end
pNextEvent = NULL;
if ( pLastEvent )
{
pLastEvent->pNextEvent = this;
pPrevEvent = pLastEvent;
}
else
{
pPrevEvent = NULL;
pFirstEvent = this;
}
pLastEvent = this;
}
--
- Vince

Dec 20 '06 #2
On Wed, 20 Dec 2006 16:54:18 -0600, "Ben Voigt" <rb*@nospam.nospamwrote:
>My EVENT struct is declared in a header file. If without making any
source
changes, I move the definition of it constructor (shown below) from one
source
(CPP) file to another, I get the same (apparently) 6144 byte increase in
the
size of my target DLL. The same happens if I move the destrustor along
with it
but does not happen if I move the destructor alone. Thanks!

That shouldn't happen if you turn on "Whole Program Optimization". When
both functions are visible to the compiler at the same time, it can optimize
cleanup in the case of exceptions, and avoid generating the extra code.
Indeed! Thank you very much. Now I can divide this thing up into manageable
chunks without penalty. Is there any reason *not* to use that option (besides
perhaps build time)?
--
- Vince
Dec 21 '06 #3

"Vincent Fatica" <ab***@localhost.comwrote in message
news:45********@news.vefatica.net...
On Wed, 20 Dec 2006 16:54:18 -0600, "Ben Voigt" <rb*@nospam.nospamwrote:
>>My EVENT struct is declared in a header file. If without making any
source
changes, I move the definition of it constructor (shown below) from one
source
(CPP) file to another, I get the same (apparently) 6144 byte increase in
the
size of my target DLL. The same happens if I move the destrustor along
with it
but does not happen if I move the destructor alone. Thanks!

That shouldn't happen if you turn on "Whole Program Optimization". When
both functions are visible to the compiler at the same time, it can
optimize
cleanup in the case of exceptions, and avoid generating the extra code.

Indeed! Thank you very much. Now I can divide this thing up into
manageable
chunks without penalty. Is there any reason *not* to use that option
(besides
perhaps build time)?
I think it's just one of the suite of optimization control options, so that
you can help the compiler team troubleshoot bugs by isolating them better.
There are a few reasons why you might not want it:

(1) It changes the object file format to contain abstract syntax trees
instead of object code. The compile step is actually performed during the
link process. This is often inappropriate for static libraries,
specifically those that will be distributed -- it makes the file far more
compiler version-dependent than it actually is, it leaks a lot more
intellectual property (since the AST is much closer to source), and I think
it also makes the files larger.

(2) It enables inlining across compilation units. This eliminates function
calls and therefore reduces the number of stack frames, degrading the
quality of stack traces. It also prevents techniques such as Detours
(hooking by rewriting function bodies in memory), because there is no longer
one single copy of the function.
--
- Vince

Dec 21 '06 #4

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

Similar topics

12
by: Brian Kelley | last post by:
def res(): try: a = 1 return finally: print "do I get here?" res() outputs "do I get here?"
6
by: Daniel Wilson | last post by:
I am having exception-handling and stability problems with .NET. I will have a block of managed code inside try...catch and will still get a generic ..NET exception box that will tell me which...
7
by: Noor | last post by:
please tell the technique of centralize exception handling without try catch blocks in c#.
2
by: tom | last post by:
Hi, I am developing a WinForm application and I am looking for a guide on where to place Exception Handling. My application is designed into three tiers UI, Business Objects, and Data Access...
4
by: Ele | last post by:
When Exception handling disabled compiler still spits out "C++ exception handler used." Why is that? Why does it ask for "Specify /EHsc"? Thanks! c:\Program Files\Microsoft Visual Studio...
5
by: | last post by:
Unfortunately I've used exception handling as a debugging tool. Now I want to be smarter about handling errors. Today in the global.asx in the Application_OnError event, I inserted code to email...
3
by: osudude | last post by:
What happens in the following scenario? 1.Via a DLL interface, a managed thread kicks off a potentially long running FOR loop operation encapsulated by a native C++ dll. This FOR loop has C++...
1
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{
5
by: Tom P. | last post by:
I have a situation that requires me to catch two different types of exceptions but do the same processing. Is there a way to do this? In VB you can stack the Catch statements but what do I do in...
0
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...
0
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,...
1
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...
0
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...
0
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
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...

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.