473,385 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

I apologise perhaps for a simple question

Hi,

my friends and i have been confused by this problem.
On a veriety of systems we have tested compiling a simple hello word
applicaation to check optimisation of C++ in 2003 VS.NET.
However on one of the machines, the best we can get is 61k under a blank
win32 console app.

We were trying to wrk out what we should tweak as we have tried excluding
Libraries, and a few other tweaks as suggested in forums.

Your help is much appreciated

Thankyou

Vicky
Jan 30 '06 #1
4 1050
Simply ensure that your code is not calling anything in the VC runtime
library. Unfortunately, I don't think this is possible from a console
application. Regardless, you can confirm this by not linking to any of the
standard libraries (see /NODEFAULTLIBRARY). Stick to Win32 API calls only.

See the notes section in
http://msdn2.microsoft.com/en-us/library/h02f9ttw.aspx

Brian
Jan 30 '06 #2
Bruno,

I followed your optimisation settings exactly, and I have a file of 4k
Thankyou ever so much, I am only recently getting to grips with C++ and VS
..NET and as such I was somewhat confused as to the lack of optimsation :o)

Would it do much harm to set these 3 options as a default global template
for each project or is it best to assign them on a per-project basis?

regards

vicky

"Bruno van Dooren" wrote:
The release executable for this empty console application is 3 K.

i set the optimization to /O1 (minimal size) and set /Os to favor size.

I also set the runtime library to /MD to use the multithreaded dll. that way
the runtime is linked dynamically instead of statically. this brought the
size from 21 k to 3 k.

for your tests, did you use the same project on different machines, or not?
the same confugration should have the same results on different machines.
kind regards,
Bruno.

"Vicky" <Vi***@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
Hi,

my friends and i have been confused by this problem.
On a veriety of systems we have tested compiling a simple hello word
applicaation to check optimisation of C++ in 2003 VS.NET.
However on one of the machines, the best we can get is 61k under a blank
win32 console app.

We were trying to wrk out what we should tweak as we have tried excluding
Libraries, and a few other tweaks as suggested in forums.

Your help is much appreciated

Thankyou

Vicky


Jan 30 '06 #3

"Vicky" <Vi***@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
Hi,

my friends and i have been confused by this problem.
On a veriety of systems we have tested compiling a simple hello word
applicaation to check optimisation of C++ in 2003 VS.NET.
However on one of the machines, the best we can get is 61k under a blank
win32 console app.

We were trying to wrk out what we should tweak as we have tried excluding
Libraries, and a few other tweaks as suggested in forums.


Are you sure you weren't looking at a Debug build in the 61K case? How are
you building the project - from a Visual Studio project (.vcproj file) or
something else?

-cd
Jan 31 '06 #4
It won't do you any harm to set these changes as part of a template, but you
should only do this for release builds. otherwise you might have the side
effect that some code gets optimized away. in that case, stepping through
the code could skip lines or things like that.

when using optimization, you also have to be careful when working with data
that is used globally. the compiler might decide that some piece of code is
doing nothing that has a visible effect,and throw it away, even though you
really use it. you have to use the 'volatile' keyword so that the compiler
knows that global data values really do change. this can be an important
factor if you share global data between threads or processes, or when
developing device drivers.

not using the volatile keyword could make the compiler decide to not really
read a pointer value, but use the value that it has in the cpu registers for
that memory address. it can do this because it could assume that the value
doesn't change where the compiler can see it.

sorry for the long winded explanation. but not using volatile correctly can
lead to problems at high optimization levels, though i have to say VC2003
and vs2005 have been much better than vc6.

kind regards,
Bruno.
"Vicky" <Vi***@discussions.microsoft.com> wrote in message
news:87**********************************@microsof t.com...
Bruno,

I followed your optimisation settings exactly, and I have a file of 4k
Thankyou ever so much, I am only recently getting to grips with C++ and VS
.NET and as such I was somewhat confused as to the lack of optimsation :o)

Would it do much harm to set these 3 options as a default global template
for each project or is it best to assign them on a per-project basis?

regards

vicky

"Bruno van Dooren" wrote:
The release executable for this empty console application is 3 K.

i set the optimization to /O1 (minimal size) and set /Os to favor size.

I also set the runtime library to /MD to use the multithreaded dll. that
way
the runtime is linked dynamically instead of statically. this brought the
size from 21 k to 3 k.

for your tests, did you use the same project on different machines, or
not?
the same confugration should have the same results on different machines.
kind regards,
Bruno.

"Vicky" <Vi***@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
> Hi,
>
> my friends and i have been confused by this problem.
> On a veriety of systems we have tested compiling a simple hello word
> applicaation to check optimisation of C++ in 2003 VS.NET.
> However on one of the machines, the best we can get is 61k under a
> blank
> win32 console app.
>
> We were trying to wrk out what we should tweak as we have tried
> excluding
> Libraries, and a few other tweaks as suggested in forums.
>
> Your help is much appreciated
>
> Thankyou
>
> Vicky


Jan 31 '06 #5

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

Similar topics

124
by: 43 | last post by:
how come m$Office isn't written in .net? how come Open Office isn't written in j2ee? how come dbms systems aren't written in either? how come browsers aren't written in either? how come...
13
by: Dick Rosser | last post by:
I asked previously, but elicited no reply, the following: Could someone please tell me how to 'marry' these two pieces of script so that script(A)posts the desired url selected from the select...
170
by: 43 | last post by:
how come m$Office isn't written in .net? how come Open Office isn't written in j2ee? how come dbms systems aren't written in either? how come browsers aren't written in either? how come...
124
by: 43 | last post by:
how come m$Office isn't written in .net? how come Open Office isn't written in j2ee? how come dbms systems aren't written in either? how come browsers aren't written in either? how come...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.