General > Chit-Chat

Bored?

(1/3) > >>

TimoVJL:
If someone have a cloudy day, check this forum chain:

http://masm32.com/board/index.php?topic=6546.msg70177#msg70177

You learn how asm programmers hate C ;)

I don't hate asm and i can compile that example C/C++ code with Visual Studio 2008 with Microsoft C/C++ compiler version 19.10 and with WinDDK 7600, and result exe is 7 kb using msvcrt.dll.

So C/C++ compiler isn't the problem, only the linked CRT.

Vortex:
Hi Timo,

I think the main problem is that M$ is deliberately obfuscating their stuff, especially the header files. Very complicated files which are not easy to translate to other languages. The increasing level of obfuscation and complexity might be the reason of that animosity. On the other side, Pelles development suit is a nice package not complicated like M$'s Visual Studio. As you mentioned, C\C++ examples can be built with the minimal dependencies like msvcrt.dll  Sadly, not everyone is aware of this.

jj2007:

--- Quote ---Countless C/C++ coders searching the internet in a desperate attempt to understand their endless error messages. Trial and error as the ultimate programming paradigm
--- End quote ---

That is just a simple description of the situation. And btw, if I do something in C, normally I use Pelles C because it just works, instead of dumping incomprehensible error crap on the user. Practically all the projects you posted here just build "as is", without desperate google searches.


--- Quote from: aw27 on September 19, 2017, 04:23:55 PM ---@JJ,
cl /GS- /TC /GL /analyze- /W3 /Gy /Zc:wchar_t /Zi /Gm- /O1 /fp:precise /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /Oi /MD /nologo /Fe /Fombr.obj mbr.cpp /link /OUT:mbr.exe /ENTRY:main /SUBSYSTEM:CONSOLE /DYNAMICBASE:NO /FIXED /MACHINE:X86 /OPT:REF /SAFESEH:NO /INCREMENTAL:NO kernel32.lib ucrt.lib

Builds a 3 KB exe.

I am sure you will not get it to work, as usual. :badgrin:
--- End quote ---

Isn't that "commandline" funny?

TimoVJL:
messy, these options are important in that case:
cl /GS- /MD /ENTRY:main /FIXED

This Small Application Wizard could be useful.

jj2007:

--- Quote from: TimoVJL on September 22, 2017, 10:20:07 AM ---messy, these options are important in that case:
cl /GS- /MD /ENTRY:main /FIXED
--- End quote ---

Sure, let's make a test:
--- Code: ---"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe" /GS- /MD /ENTRY:main /FIXED "Tmp.c" user32.lib kernel32.lib ucrt.lib

Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9002 : ignoring unknown option '/ENTRY:main'
Tmp.c
Tmp.c: fatal error C1083: Cannot open include file: 'XED': No such file or directory
--- End code ---

So sad, as Donald Dumb would say :'(

But let's test also the long commandline of aw27:
--- Code: ---J:\Masm32\MasmBasic\Res>"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe" /GS- /TC /GL /analyze- /W3 /Gy /Zc:wchar_t /
Zi /Gm- /O1 /fp:precise /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /
Oi /MD /nologo /Fe /Fombr.obj Tmp.cpp /link /OUT:mbr.exe /ENTRY:main /SUBSYSTEM:CONSOLE /DYNAMICBASE:NO /FIXED /MACHINE:X86 /OPT:REF /SA
FESEH:NO /INCREMENTAL:NO kernel32.lib ucrt.lib
Tmp.cpp
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(79): error C2059: syntax error: '['
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(110): error C2059: syntax error: '['
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(141): error C2059: syntax error: '['
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(153): error C2059: syntax error: '['
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(163): error C2059: syntax error: '['
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(174): error C2059: syntax error: '['
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(184): error C2059: syntax error: '['
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(194): error C2059: syntax error: '['
c:\program files (x86)\microsoft visual studio 10.0\vc\include\codeanalysis\sourceannotations.h(206): error C2059: syntax error: '['
--- End code ---

More trial and error...? Now I will tell you a secret: This ridiculously simple hello world proggie fails miserably with various versions of MCVC and GCC, despite the commandlines suggested by real expertsTM, but it builds fine with Pelles C - provided you do something very logical, that is, add a W to the line
HANDLE hFile = CreateFile(L"\\\\.\\PhysicalDrive0", ...

Of course, it will still fail miserably with the other compilers, but hey, wouldn't it be fun to spend some weeks on solving the puzzle? Especially if you are bored, of course 8)

Navigation

[0] Message Index

[#] Next page

Go to full version