im trying to learn c (old and classic C, not c++ or c#)
my question is that where can i find a set of full documents about header files (.h files for #include)?
i'm also using tcc (tiny c compiler), but i found out that this compiler has some minor problems, is there any portable c compiler that i can keep it in flash drive without any installation? what complier should i use?
note: sorry for my bad grammar
asking some info about C
-
- Posts: 11
- Joined: Sat Apr 13, 2019 7:45 pm
Re: asking some info about C
As a compiler you may try PellesC
-
- Posts: 416
- Joined: Sat Sep 15, 2018 5:22 am
Re: asking some info about C
peter2005 wrote:As a compiler you may try PellesC
thank you for your answer
i also need to know that all of complied c codes (compiled to exe or dll) can run stand-alone or not, i choosed tcc at first, because it was stand-alone and not reqired any runtime (maybe this is a stupid question since c is free-module and its up to programmer code that may required external libraries), but for example, C# needs runtime to work
-
- Posts: 11
- Joined: Sat Apr 13, 2019 7:45 pm
Re: asking some info about C
Shokoniraya wrote:peter2005 wrote:As a compiler you may try PellesC
thank you for your answer
i also need to know that all of complied c codes (compiled to exe or dll) can run stand-alone or not, i choosed tcc at first, because it was stand-alone and not reqired any runtime (maybe this is a stupid question since c is free-module and its up to programmer code that may required external libraries), but for example, C# needs runtime to work
I checked my compiled files, there is by default only kernel32.dll dependency.
-
- Posts: 250
- Joined: Sat Dec 27, 2014 8:49 pm
Re: asking some info about C
You can find an archived copy of the final draft for the current C standard (C17) here for free:
https://web.archive.org/web/20181230041 ... d_fdis.pdf
This covers literally everything to know about the language, as it is the standards for C.
For C and C++, this depends on your compiler/link being used. If they offer static linking, then you can statically link to the runtime being used which will make your apps / dlls able to run without needing a separate runtime. This is not dependent on the language itself.
https://web.archive.org/web/20181230041 ... d_fdis.pdf
This covers literally everything to know about the language, as it is the standards for C.
Shokoniraya wrote:i also need to know that all of complied c codes (compiled to exe or dll) can run stand-alone or not
For C and C++, this depends on your compiler/link being used. If they offer static linking, then you can statically link to the runtime being used which will make your apps / dlls able to run without needing a separate runtime. This is not dependent on the language itself.
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: asking some info about C
And if you use gcc remember to ever add -static to the command you use for building.
Personally I also like -mtune=generic that makes your exe compatible with older CPUs and -m32 to make it 32bit (for retro-compatibility with old WinXP/7).
If curious, the following are the main gcc switches I use for building quickbms:
They are used for smaller exe size, optimized instructions, stack security, larger stack, dynamic locations and so on.
Older versions of gcc create smaller executables.
Personally I also like -mtune=generic that makes your exe compatible with older CPUs and -m32 to make it 32bit (for retro-compatibility with old WinXP/7).
If curious, the following are the main gcc switches I use for building quickbms:
-s -O2 -Wl,--enable-stdcall-fixup -Wl,--large-address-aware -mtune=generic -fno-unit-at-a-time -m32 -Wl,--stack,4194304 -fstack-protector-all -Wstack-protector -fwrapv --param ssp-buffer-size=1 -fno-strict-overflow -Wformat-security -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-auto-image-base -Wl,--enable-auto-import -fno-omit-frame-pointer -static -Wall
They are used for smaller exe size, optimized instructions, stack security, larger stack, dynamic locations and so on.
Older versions of gcc create smaller executables.
-
- Posts: 416
- Joined: Sat Sep 15, 2018 5:22 am
Re: asking some info about C
sir aluigi, i want to know that is there any portable gcc?
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: asking some info about C
gcc is multiplatform and on Windows it's called Mingw gcc.
What you need is using MSYS2:
https://www.msys2.org/
It's a complete setup made with packages (pacman) so it's super easy to install and update everything everytime you desire.
Additionally it runs the latest version of gcc 10 and has both 32bit (mingw32) and 64bit (mingw64) versions.
What you need is using MSYS2:
https://www.msys2.org/
It's a complete setup made with packages (pacman) so it's super easy to install and update everything everytime you desire.
Additionally it runs the latest version of gcc 10 and has both 32bit (mingw32) and 64bit (mingw64) versions.