News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

c++ versus masm

Started by clamicun, July 03, 2019, 06:12:36 PM

Previous topic - Next topic

clamicun

Last week I "translated" one of my Masm programs into c++.
It is not better or worse but the exe file is much larger.
Probably not very well written.

Think I stay with Masm.

For those interested, here is the source compiled with dev-cpp.
My machine: Windows10 64b

TimoVJL

strip off debug-info and size is 918 KB
and without static crt size is 902 KB
May the source be with you

clamicun

TimoVJL,
This is the first c++ program I ever wrote.
I haven't the slightest idea what you mean.

TimoVJL

Check this in Dev-C++:
Project -> Project Options ... -> Compiler -> Linker  -> Strip executable (-s) Yes

Ctrl+H opens Project Options.

and then size is something like 920 KB.
May the source be with you

clamicun


jcfuller

What is the size of your masm version?

James

clamicun


aw27

What is more surprising is that the background.bmp alone accounts for 778KB, this is a real miracle :badgrin:


jj2007

Quote from: clamicun on July 04, 2019, 07:06:42 AM
50% smaller
Quote from: AW on July 04, 2019, 03:21:30 PM
the background.bmp alone accounts for 778KB


Assembly rocks!
C++  exe 920 KB - 778KB =  142 KB real code
Masm exe 460 kB - 778KB = -318 KB real code

TimoVJL

.rsrc 909312 bytes 888 KB
.rsrc + .rdata DF000h 913408 bytes 892 KB
Dump of file DateiManager.exe

File Type: EXECUTABLE IMAGE

  Summary

        1000 .CRT
        1000 .bss
        1000 .data
        2000 .idata
        1000 .pdata
        1000 .rdata
       DE000 .rsrc
        5000 .text
        1000 .tls
        1000 .xdata
May the source be with you

clamicun

Thank you all,
the masm version doesn't use the bmp on the mainwindow.
That's the secret

daydreamer

isnt the right word you "discompiled" your masm code? :biggrin:
(like disassembler,but opposite C++ compiler)
modern C++ compiler has an advantage of not including functions/PROC that are never called and assembly has its advantages of make code small,could it be possible to have conditional assembly do the same thing make assembler code even smaller?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Absolutely, daydreamer! Why don't you test it and post an example?

HSE

Quote from: daydreamer on July 06, 2019, 04:24:09 AM
...not including functions/PROC that are never called...
If you make assembly programing in a modular way, assemblers don't include functions never called.  :thumbsup:
Equations in Assembly: SmplMath

TimoVJL

#14
uasm supports COMDAT with it's own way.

a smart linker don't include unused code.
May the source be with you