About Visual C++ 2005 Express Edition

M

mistral

Does Visual C++ 2005 Express Edition produce small, compact C
executables?
Or there is another C compilers that do this better?

m.
 
J

jacob navia

mistral said:
Does Visual C++ 2005 Express Edition produce small, compact C
executables?
Or there is another C compilers that do this better?

m.
lcc-win32 produces (sometimes) smaller executables. The only
optimizations lcc-win32 does actually, are optimizations that delete
instructions, so the code is quite compact. The size of the libraries is
smaller too. Custom implementations could be smaller, if you
have a budget for them.

jacob

http://www.cs.virginia.edu/~lcc-win32
 
R

Richard Heathfield

mistral said:
Does Visual C++ 2005 Express Edition produce small, compact C
executables?

Let's find out.

<later>

Well, it depends on what you mean by "small". :)
Or there is another C compilers that do this better?

Here's a small source file, which should show up the overhead of various
compilers quite well:

#include <stdio.h>
int main(void)
{
puts("Hello world");
return 0;
}

Here are the executable image sizes, in bytes (implementations with "C++" in
their title were invoked in C mode!):

gcc 2.81 for DOS: 92403
Visual C++ 5.0: 81408
Borland C++ 5.3: 55296
Borland C++ 5.6: 50688
Visual C++ 2005 Express Edition: 40960
gcc 2.95.3 for Linux: 34686
Visual C++ 6.0: 28672
Visual C++ 1.5: 5699
Turbo C++ 1.01: 4760

I tried to download lcc-win32 for comparison purposes, but the main site's
download link was bad, and the backup site screamed "bad gateway" at me, so
I guess that comparison will have to wait for some other day.
 
M

mistral

Richard Heathfield пиÑал(а):
mistral said:


Let's find out.

<later>

Well, it depends on what you mean by "small". :)


Here's a small source file, which should show up the overhead of various
compilers quite well:

#include <stdio.h>
int main(void)
{
puts("Hello world");
return 0;
}

Here are the executable image sizes, in bytes (implementations with "C++" in
their title were invoked in C mode!):

gcc 2.81 for DOS: 92403
Visual C++ 5.0: 81408
Borland C++ 5.3: 55296
Borland C++ 5.6: 50688
Visual C++ 2005 Express Edition: 40960
gcc 2.95.3 for Linux: 34686
Visual C++ 6.0: 28672
Visual C++ 1.5: 5699
Turbo C++ 1.01: 4760

I tried to download lcc-win32 for comparison purposes, but the main site's
download link was bad, and the backup site screamed "bad gateway" at me, so
I guess that comparison will have to wait for some other day.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
--------------

The most code has compiler and platform dependancies?
In 'c' sources codes was not specified what compiler originally used.
Probably, better use Windows/X86 specific compiler (i.e. non
portable), freeware is Visual C++ 2005 Express Edition only?

m.
 
R

Richard Heathfield

mistral said:
Richard Heathfield ?????(?):

The most code has compiler and platform dependancies?

That's a meaningless question, but I presume you meant something by it, so
could you possibly re-phrase it?
In 'c' sources codes was not specified what compiler originally used.

Again, I don't understand this.
Probably, better use Windows/X86 specific compiler (i.e. non
portable), freeware is Visual C++ 2005 Express Edition only?

Of the compilers I listed above, gcc and VC2005 are both freeware. Borland
also do a couple of freeware compilers. See also Digital Mars, MinGW, lcc,
and Pacific C. I suppose there's also lcc-win32, but I tried to get it
earlier today and failed completely so I suppose it's no longer available.

On the following page, you will find hyperlinks to their home pages:

http://www.cpax.org.uk/prg/portable/c/resources.php#FreeCompilers
 
G

Guest

jacob said:
lcc-win32 produces (sometimes) smaller executables. The only
That must be rare, there's many tricks that can save enormous amount
of generated code, and visual studio can do alot of them..
optimizations lcc-win32 does actually, are optimizations that delete
instructions, so the code is quite compact. The size of the libraries is
smaller too. Custom implementations could be smaller, if you
have a budget for them.
How different is it from the lcc available for e.g. linux ?
It always generates function pre/postambles to save and
restore certain registers even if they're never used..
 
J

jacob navia

Nils said:
That must be rare, there's many tricks that can save enormous amount
of generated code, and visual studio can do alot of them..


How different is it from the lcc available for e.g. linux ?
It always generates function pre/postambles to save and
restore certain registers even if they're never used..

I have rewritten most of the code there. It is now VERY rare
that a register is saved when there is no need.

I have added:
o register variables, automatically choosen by the compiler
o A peephole optimizer for the 386
o Added many optimizations like constant folding, and others.
 
M

mistral

Richard Heathfield пиÑал(а):
mistral said:
Richard Heathfield ?????(?):
mistral said:

Does Visual C++ 2005 Express Edition produce small, compact C
executables?
Let's find out.

Well, it depends on what you mean by "small". :)

Or there is another C compilers that do this better?
Here's a small source file, which should show up the overhead of various
compilers quite well:
#include <stdio.h>
int main(void)
{
puts("Hello world");
return 0;
}

Here are the executable image sizes, in bytes (implementations with "C++"
in their title were invoked in C mode!):
gcc 2.81 for DOS: 92403
Visual C++ 5.0: 81408
Borland C++ 5.3: 55296
Borland C++ 5.6: 50688
Visual C++ 2005 Express Edition: 40960
gcc 2.95.3 for Linux: 34686
Visual C++ 6.0: 28672
Visual C++ 1.5: 5699
Turbo C++ 1.01: 4760
I tried to download lcc-win32 for comparison purposes, but the main
site's download link was bad, and the backup site screamed "bad gateway"
at me, so I guess that comparison will have to wait for some other day.

The most code has compiler and platform dependancies?
That's a meaningless question, but I presume you meant something by it, so
could you possibly re-phrase it?

In 'c' sources codes was not specified what compiler originally used.
Again, I don't understand this.

Probably, better use Windows/X86 specific compiler (i.e. non
portable), freeware is Visual C++ 2005 Express Edition only?
Of the compilers I listed above, gcc and VC2005 are both freeware. Borland
also do a couple of freeware compilers. See also Digital Mars, MinGW, lcc,
and Pacific C. I suppose there's also lcc-win32, but I tried to get it
earlier today and failed completely so I suppose it's no longer available.
On the following page, you will find hyperlinks to their home pages:

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
------------

I just meant, that there are no specified in a source code, what
compiler author used.

Well, most portables files produce Visual C++ 1.5 and Turbo C++ 1.01.
However, this does not mean that it have better optimization, because
this compilers may just use dynamically linked dll (crtdll.dll) that
can be often in use in system, so this may affect on speed.
Not clear why so big difference in size between Visual C++ 2005 Express
Edition and old Visual C++ 1.5?

mistral
 
J

jacob navia

Richard said:
mistral said:




Let's find out.

<later>

Well, it depends on what you mean by "small". :)




Here's a small source file, which should show up the overhead of various
compilers quite well:

#include <stdio.h>
int main(void)
{
puts("Hello world");
return 0;
}

Here are the executable image sizes, in bytes (implementations with "C++" in
their title were invoked in C mode!):

gcc 2.81 for DOS: 92403
Visual C++ 5.0: 81408
Borland C++ 5.3: 55296
Borland C++ 5.6: 50688
Visual C++ 2005 Express Edition: 40960
gcc 2.95.3 for Linux: 34686
Visual C++ 6.0: 28672
Visual C++ 1.5: 5699
Turbo C++ 1.01: 4760

I tried to download lcc-win32 for comparison purposes, but the main site's
download link was bad, and the backup site screamed "bad gateway" at me, so
I guess that comparison will have to wait for some other day.

Yes, virginia.edu is down

My data point is
lcc-win32 3104 bytes

compilation options
lc -O thello.c -s

But a more realistic example is:
#include <stdio.h>
int main(void)
{
printf("Hello world");
return 0;
}

This produces a code of 42 283 bytes (statically linked libc)
With dynamically linked libc we go down to 8152 bytes.

The code of printf is very bulky since needs an extended precision
library to correctly print denormal floating point numbers with all
the required precision. This is one of the few printfs that gets it
right, together with gcc's printf.

jacob
 
R

Richard Heathfield

mistral said:

I just meant, that there are no specified in a source code, what
compiler author used.

If it matters, it may well be written down in the source code somewhere, but
there is no requirement on programmers to document which compiler they
first targeted. Indeed, for code that is topical in comp.lang.c it doesn't
matter, because the code will work on /any/ compiler.
Well, most portables files produce Visual C++ 1.5 and Turbo C++ 1.01.

No. Those are the /smallest/ files. "Smallest" and "most portable" are two
different ideas.
However, this does not mean that it have better optimization, because
this compilers may just use dynamically linked dll (crtdll.dll) that
can be often in use in system, so this may affect on speed.

No, that's not the reason.
Not clear why so big difference in size between Visual C++ 2005 Express
Edition and old Visual C++ 1.5?

It's almost certainly (a) because VC1.5 created the executable program with
16-bit ints, 16-bit pointers, etc, whereas VC2005 probably used 32- or
possibly even 64-bit ints and pointers, and (b) because the older compiler
was targeting MS-DOS, a fairly simple and primitive set of interrupts,
whereas the newer compiler is targeting MS-Windows, a far more complicated
and advanced set of interruptions.
 
J

jacob navia

Richard said:
mistral said:




That's a meaningless question, but I presume you meant something by it, so
could you possibly re-phrase it?




Again, I don't understand this.




Of the compilers I listed above, gcc and VC2005 are both freeware. Borland
also do a couple of freeware compilers. See also Digital Mars, MinGW, lcc,
and Pacific C. I suppose there's also lcc-win32, but I tried to get it
earlier today and failed completely so I suppose it's no longer available.

This is wrong. virginia.edu is down TODAY.

An alternative site is:

http://www.q-software-solutions.de

I can't GUARANTEE 100% availibity and you should know perfectly well
that the compiler IS AVAILABLE!!!

Dammed lies!
 
K

Keith Thompson

jacob navia said:
Richard Heathfield wrote: [...]
Here's a small source file, which should show up the overhead of
various compilers quite well:
#include <stdio.h>
int main(void)
{
puts("Hello world");
return 0;
}
Here are the executable image sizes, in bytes (implementations with
"C++" in their title were invoked in C mode!):
gcc 2.81 for DOS: 92403
Visual C++ 5.0: 81408
Borland C++ 5.3: 55296
Borland C++ 5.6: 50688
Visual C++ 2005 Express Edition: 40960
gcc 2.95.3 for Linux: 34686
Visual C++ 6.0: 28672
Visual C++ 1.5: 5699
Turbo C++ 1.01: 4760
I tried to download lcc-win32 for comparison purposes, but the main
site's download link was bad, and the backup site screamed "bad
gateway" at me, so I guess that comparison will have to wait for
some other day.

Yes, virginia.edu is down

My data point is
lcc-win32 3104 bytes

compilation options
lc -O thello.c -s

But a more realistic example is:
#include <stdio.h>
int main(void)
{
printf("Hello world");
return 0;
}

This produces a code of 42 283 bytes (statically linked libc)
With dynamically linked libc we go down to 8152 bytes.

But that's not a useful comparison unless you have sizes for *the same
program* for other compilers.
The code of printf is very bulky since needs an extended precision
library to correctly print denormal floating point numbers with all
the required precision. This is one of the few printfs that gets it
right, together with gcc's printf.

gcc has no printf; gcc is a compiler, not a complete implementation.
It uses whatever runtime library is provided by the operating system.
Do you mean glibc's printf?
 
J

jacob navia

Keith said:
jacob navia said:
Richard Heathfield wrote:
[...]
Here's a small source file, which should show up the overhead of
various compilers quite well:
#include <stdio.h>
int main(void)
{
puts("Hello world");
return 0;
}
Here are the executable image sizes, in bytes (implementations with
"C++" in their title were invoked in C mode!):
gcc 2.81 for DOS: 92403
Visual C++ 5.0: 81408
Borland C++ 5.3: 55296
Borland C++ 5.6: 50688
Visual C++ 2005 Express Edition: 40960
gcc 2.95.3 for Linux: 34686
Visual C++ 6.0: 28672
Visual C++ 1.5: 5699
Turbo C++ 1.01: 4760
I tried to download lcc-win32 for comparison purposes, but the main
site's download link was bad, and the backup site screamed "bad
gateway" at me, so I guess that comparison will have to wait for
some other day.

Yes, virginia.edu is down

My data point is
lcc-win32 3104 bytes

compilation options
lc -O thello.c -s

But a more realistic example is:
#include <stdio.h>
int main(void)
{
printf("Hello world");
return 0;
}

This produces a code of 42 283 bytes (statically linked libc)
With dynamically linked libc we go down to 8152 bytes.


But that's not a useful comparison unless you have sizes for *the same
program* for other compilers.

Heathfield's sample used puts. Puts is MUCH smaller than printf OF COURSE.

I just showed a more realistical example. Even with all printf, 8K
is very good in Heathfield's list. Using puts() I am the smallest.
gcc has no printf; gcc is a compiler, not a complete implementation.
It uses whatever runtime library is provided by the operating system.
Do you mean glibc's printf?

Obvious. Technically you are right, it's glibc's printf
 
R

Richard Heathfield

jacob navia said:
This is wrong.

Ah, I was mistaken in my supposition? I do apologise.
virginia.edu is down TODAY.
Fine.

An alternative site is:

http://www.q-software-solutions.de

That told me "bad gateway".
I can't GUARANTEE 100% availibity and you should know perfectly well
that the compiler IS AVAILABLE!!!

Except for me, apparently.
Dammed lies!

Careful with that word, sirrah. If the compiler were available, I'd have
been able to download it, right?
 
R

Richard Heathfield

jacob navia said:
Keith said:
jacob navia said:
Richard Heathfield wrote:
[...]

Here's a small source file, which should show up the overhead of
various compilers quite well:
#include <stdio.h>
int main(void)
{
puts("Hello world");
return 0;
}
Here are the executable image sizes, in bytes (implementations with
"C++" in their title were invoked in C mode!):
gcc 2.81 for DOS: 92403
Visual C++ 5.0: 81408
Borland C++ 5.3: 55296
Borland C++ 5.6: 50688
Visual C++ 2005 Express Edition: 40960
gcc 2.95.3 for Linux: 34686
Visual C++ 6.0: 28672
Visual C++ 1.5: 5699
Turbo C++ 1.01: 4760
I tried to download lcc-win32 for comparison purposes, but the main
site's download link was bad, and the backup site screamed "bad
gateway" at me, so I guess that comparison will have to wait for
some other day.


Yes, virginia.edu is down

My data point is
lcc-win32 3104 bytes

compilation options
lc -O thello.c -s

But a more realistic example is:
#include <stdio.h>
int main(void)
{
printf("Hello world");
return 0;
}

This produces a code of 42 283 bytes (statically linked libc)
With dynamically linked libc we go down to 8152 bytes.

But that's not a useful comparison unless you have sizes for *the same
program* for other compilers.

Heathfield's sample used puts. Puts is MUCH smaller than printf OF COURSE.

Yes, of course it is, and with good reason. What I was trying to demonstrate
was the baseline sizes of executables under various compilers. I was not
trying to compare printf implementations. puts was neither here nor there,
since it's a trivial loop, a few bytes of object code at most.

What might prove interesting is to define a series of programs of increasing
complexity, measuring their sizes on a variety of implementations, and
graphing them together.
I just showed a more realistical example.

Why is printf more realistic than puts?
I just showed a more realistical example. Even with all printf, 8K
is very good in Heathfield's list. Using puts() I am the smallest.

Except that all my figures were for statically linked programs, so your
figure is actually 42KB, which is in the worse half of the list.
 
A

Andrew Poelstra

Here are the executable image sizes, in bytes (implementations with "C
++" in
their title were invoked in C mode!):

gcc 2.81 for DOS: 92403
Visual C++ 5.0: 81408
Borland C++ 5.3: 55296
Borland C++ 5.6: 50688
Visual C++ 2005 Express Edition: 40960
gcc 2.95.3 for Linux: 34686
Visual C++ 6.0: 28672
Visual C++ 1.5: 5699
Turbo C++ 1.01: 4760

I tried with gcc 4.1.1 (on Linux) and the executable size was 4710. It
was a little lower when I did it without all the pedantic flags set:
4694.

I'd consider that a reason for you to upgrade. :)
 
R

Richard Heathfield

Andrew Poelstra said:
I tried with gcc 4.1.1 (on Linux) and the executable size was 4710. It
was a little lower when I did it without all the pedantic flags set:
4694.

Oh, if I messed about with flags, I could get it down a bit. Just adding -O
cuts out 60% of the flab. strip knocks it down to 3088, which is even
slimmer than yours. (You don't say if you used strip.)
I'd consider that a reason for you to upgrade. :)

Nah. It ain't broke, and it's quick enough, and it doesn't pretend to be
something it isn't, so I'll leave it as it is for now.
 
J

John Smith

Richard said:
mistral said:




Let's find out.
Here's a small source file, which should show up the overhead of various
compilers quite well:

#include <stdio.h>
int main(void)
{
puts("Hello world");
return 0;
}

Here are the executable image sizes, in bytes (implementations with "C++" in
their title were invoked in C mode!):

gcc 2.81 for DOS: 92403
Visual C++ 5.0: 81408
Borland C++ 5.3: 55296
Borland C++ 5.6: 50688
Visual C++ 2005 Express Edition: 40960
gcc 2.95.3 for Linux: 34686
Visual C++ 6.0: 28672
Visual C++ 1.5: 5699
Turbo C++ 1.01: 4760

Here are some others:

Digital Mars 40,476
Open Watcom 25,600
Pelles C 14,848
lcc-win32 9,680

lcc-win32 produced the smallest executable, but had the slowest
compile and execution times.
 
J

jacob navia

John said:
Here are some others:

Digital Mars 40,476
Open Watcom 25,600
Pelles C 14,848
lcc-win32 9,680

lcc-win32 produced the smallest executable, but had the slowest compile
and execution times.

Excuse me but the compile time is 90ms in my machine, almost
at the measuring level!

And for printing a short character string I had the slowest time?????

This is just a call to the OS!!!

Besides, in normal programs I have at least 5 times the compilation
speed of gcc, and about the same than MSVC (latest versions)

jacob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top