Hi,

On Sat, Oct 31, 2020 at 4:11 PM Paul Dufresne via Freedos-devel
<freedos-devel@lists.sourceforge.net> wrote:
>
> Well, after having a problem with IA-16 gcc (which seems to requires DJGPP 
> gcc installed and working), I have search for an other free C compiler for 
> FreeDOS.

I can send you a .BAT to setup IA16-GCC in FreeDOS, if you're having
trouble. It may have a few rare bugs, but it's not bad. (I used
p7zip920 to unpack.)

> I have found Smaller C:
> https://github.com/alexfru/SmallerC/blob/master/v0100/doc/smlrc.md

SmallerC is genius, and I've played with it several times over the years.

> I note: Smaller C is not an optimizing compiler, but it does the job better 
> than the typical small C implementation.

Note that I made a 3.5" 1.44 MB single-floppy .7z (compressed) DJGPP
installation years ago. It was fairly old even then (GCC 2.95.3,
BinUtils 2.16.1, DJDEV 2.03p2) with a few bundled utils, but it worked
well (in moderate testing). There are other options, too, but it
depends on what you want and are trying to do.

Note that SmallerC is always 386+ (same as DJGPP) but it can output
real mode (-dosh is default Huge) and several models (not sure if
they're fully supported, though, e.g. "-dost"). "-dosp" is the 32-bit
pmode / DPMI version using CWSDPMI while -dosu is "unreal", IIRC.

SmallerC isn't really optimizing, no, so even ancient GCC 2.95.3 is
probably faster, but anything is faster than Turbo C 2.01 (buggy /
unbuffered by default). That problem was apparently later corrected in
Turbo C++ 1.01.

> I installed it in a new minimal FD-1.3-rc3 image (more like injected it in 
> QEMU qcow2 image, by using:
> https://gist.github.com/shamil/62935d9b456a6f9877b5 ), and was able to 
> compile test.c:

It's very easy to setup and test, IMHO. I even used it as a .BAT test
in my MetaDOS image.

> #include <stdio.h>
> void main(){
>   printf("Smaller C is fine!\n"); // Oh well, I change a bit the string here
> }

1). Why C99 comments?? SmallerC "mostly" supports C89 with some bits
of C99, too.
2). int main(void) or (int argc, char** argv) is preferred.
3). puts() is simpler (and implies "\n" at end).
4). You didn't "return EXIT_SUCCESS;"
5). You may wish to use some Lint (maybe DJGPP's port of Splint). Or
at least compare your code with "gcc -std=c99 -pedantic -Wall
-Wextra".

> directly from the ...\SMALLERC\V0100\BIND directory with:
> smlrcc test.c -o test.exe

"-Wall" might sometimes (rarely) help here. (Not sure he really
intended to warn on literally everything.)

> resulting in 20k test.exe by just installing nasm and make sure it is in PATH 
> (Apparently come with a linker for ELF format to DOS 16 or 32 bits format).

He recommends YASM, which is much *much* faster than NASM here. You
can also use FASM ("-asm n2f") for 32-bit only (e.g. "-dosp"). You can
also "set NASMENV=-O0" for a small speedup, if you don't have YASM.

> The compiler executables are about 700k, but this does not include libs and 
> includes.

It's very portable and can even rebuild itself. It's truly great work.

> You should probably be aware of this issue:
> https://github.com/alexfru/SmallerC/issues/26  (Virus/trojan false positives: 
> SMLRC has many false positives on Windows #26)

All of those are bogus (yes, I already told him), usually because of
"heuristics" (aka, blind guesses) which are usually wrong. It stinks,
but AV companies are sloppy (but also have a lot to deal with).

> License seems BSD: https://github.com/alexfru/SmallerC/blob/master/license.txt
>
> I think I'd like to have it in FreeDOS 1.3.

I halfway wanted to make a proper package years ago, but I never found
the time nor energy. There's just too much to do, and I'm very easily
distracted these days.

But SmallerC is amazing, and Alexei is a genius. I would strongly
recommend somebody (Jerome? Jim?) mirror this to iBiblio "as is". A
proper package can come later.


_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to