Op 2 jun. 2017 9:54 p.m. schreef "bob by" <[email protected]>:

2017-06-02 22:24 GMT+04:00 Ruben Van Boxem <[email protected]>:

> Be sure to check the final program code size in case of using such a
> utility library vs just the C++ standard library. You might be
surprised...
>
> Also important to note c++ isn't just an object oriented language. It is
so
> much more. If you get through the initial syntactical and semantical
> hurdles of the language and its intricacies.
>
> Lastly I would like to emphasise that unless you are programming a
> microwave or router that this whole discussion based on the size of a
hello
> world program is outright ridiculous. Write a complex program, and then
> discuss the advantages of one language over another.
>
> And now, on to the weekend!
>

Rude. You told pretty much nothing.


I'm sorry you feel that way.

Let me sum up the things I told you and the list:
0. Tl;DR If you want to write c++ code, write c++ code and stop obsessing
over unimportant things like 500kB of binary.
Now for the points I did make in my previous message:
1. Executable size in the order of 500kB means nothing unless you are
programming a memory constrained system. Such a system won't be running
Windows, so getting your Hello World program size down is a waste of time.
2. Rewriting the logic contained in the C++ standard library, libgcc, etc
will require code. It will be less than but near the same size. Using a C
utility library to give you certain things will have a similar effect than
just using the C++ standard library.
3. I pointed out that a limiting definition of C++ as "object-oriented
language" is just not fair to the possibilities it provides. There is so
much more that C cannot possibly give you. Granted, I'm not saying one is
better than the other. Both have their domain. But C++ is a must paradigm
language in which you can write the most funky/cool stuff if you get the
hang of it.
Additionally, because you've got me typing again:
4. Don't reinvent the wheel. Especially when you're learning as you seem to
be. Writing your own cout will only result in bugs because you missed all
the corner cases. Especially when your code becomes more and more complex.

If you want the smallest executable possible, you don't link with any
runtime library (not even msvcrt), but instead link directly to ntdll.dll
and user32.dll, set up a custom entry point, and call the Win32 API
WriteConsole function. Just remember you can't actually do anything useful
then, because all of the C and C++ library functions are off limits.

Ruben

------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to