Which lean C compiler for 32-bit OS development

N

Nick Keighley

I had noticed a certain tendency towards that.  I actually rather
like some of Jacob's ideas,

ditto. He has ideas that are worth discussing. If he were willing too.

but after a while I plonked him because it was too
frustrating trying to talk to him about them.  My options were
simpering praise or being yelled at for my malicious and carefully
planned campaign of slander.  Apparently, "being interested but
having a suggestion for an improvement" is not one of the available
states.

you can't even have a technical difference of opinion, or suggest
there may be some other option without it being construed as a
personnel attack. Apparently I'm a moron for not agreeing whole-
heartedly with him.
 
N

Nick Keighley

Le 13/11/11 04:13, Joe Wright a écrit :



"Indeed".

You fail to mention that mingw has a C99 compiler but a C80
Microsoft furnished library. This leads to some problems, as you may
have noticed.

long double?
 
I

ImpalerCore

Le 13/11/11 04:13, Joe Wright a écrit :



"Indeed".

You fail to mention that mingw has a C99 compiler but a C80
Microsoft furnished library. This leads to some problems, as you may
have noticed.

lcc-win has essential parts of the C99 library like printf rewritten.
I do not use tha Microsoft printf, so at least the compiler is
coherent with the C library.

Actually, I recently just blew away my MinGW and reinstalled
everything. In the latest version of GCC (4.6.1), the C99 printf
modifiers appear to work. Not sure what they changed, but it appears
that some workaround has been integrated into the MinGW toolchain.

Best regards,
John D.
 
K

Keith Thompson

ImpalerCore said:
Actually, I recently just blew away my MinGW and reinstalled
everything. In the latest version of GCC (4.6.1), the C99 printf
modifiers appear to work. Not sure what they changed, but it appears
that some workaround has been integrated into the MinGW toolchain.

Interesting. I just did the same thing, and it still doesn't work
correctly.

Under Cygwin, this program:

#include <stdio.h>
int main(void) {
float f = 123.456;
double d = 123.456;
long double ld = 123.456;

printf("float: %d bytes, double: %d bytes, long double: %d bytes\n",
(int)sizeof (float),
(int)sizeof (double),
(int)sizeof (long double));
printf("f = %g\n", f);
printf("d = %g\n", d);
printf("ld = %Lg\n", ld);
return 0;
}

produces this (correct) output:

float: 4 bytes, double: 8 bytes, long double: 12 bytes
f = 123.456
d = 123.456
ld = 123.456

Under MinGW, installed from scratch on Windows 7 just a few minutes
ago,, with gcc 4.6.1, the same program produces this output:

float: 4 bytes, double: 8 bytes, long double: 12 bytes
f = 123.456
d = 123.456
ld = -6.41666e+264

Can you try this program on your system?
 
J

jacob navia

Le 15/11/11 23:42, Keith Thompson a écrit :
Under MinGW, installed from scratch on Windows 7 just a few minutes
ago,, with gcc 4.6.1, the same program produces this output:

float: 4 bytes, double: 8 bytes, long double: 12 bytes
f = 123.456
d = 123.456
ld = -6.41666e+264

Can you try this program on your system?

Try long long, it is bugged too.
That's why I rewrote printf from scratch.

And added all missing C99 functions lke the ones for setting
unsetting floating point precision, etc.

Years of work.
 
I

ImpalerCore

[...]
Actually, I recently just blew away my MinGW and reinstalled
everything.  In the latest version of GCC (4.6.1), the C99 printf
modifiers appear to work.  Not sure what they changed, but it appears
that some workaround has been integrated into the MinGW toolchain.

Interesting.  I just did the same thing, and it still doesn't work
correctly.

Under Cygwin, this program:

#include <stdio.h>
int main(void) {
    float f        = 123.456;
    double d       = 123.456;
    long double ld = 123.456;

    printf("float: %d bytes, double: %d bytes, long double: %d bytes\n",
           (int)sizeof (float),
           (int)sizeof (double),
           (int)sizeof (long double));
    printf("f  = %g\n",   f);
    printf("d  = %g\n",   d);
    printf("ld = %Lg\n", ld);
    return 0;

}

produces this (correct) output:

float: 4 bytes, double: 8 bytes, long double: 12 bytes
f  = 123.456
d  = 123.456
ld = 123.456

Under MinGW, installed from scratch on Windows 7 just a few minutes
ago,, with gcc 4.6.1, the same program produces this output:

float: 4 bytes, double: 8 bytes, long double: 12 bytes
f  = 123.456
d  = 123.456
ld = -6.41666e+264

Can you try this program on your system?

I get the same result as you. It seems that their 'long double'
modifier is still broken. Still, I raised an eyebrow when %zu, %td,
%llu, and %lld started working.

\code
#include <stdio.h>
#include <limits.h>
#include <stdint.h>
#include <inttypes.h>

int main( void )
{
printf( "
------------------------------------------------------------------------
\n" );
printf( "| type | specifier | limit |
value |\n" );
printf( "
------------------------------------------------------------------------
\n" );

printf( " %-18s %-9s %-13s %" PRId8 "\n",
"int8_t", PRId8, "INT8_MIN", INT8_MIN );
printf( " %-18s %-9s %-13s %" PRId8 "\n",
"", "", "INT8_MAX", INT8_MAX );

printf( " %-18s %-9s %-13s %" PRId16 "\n",
"int16_t", PRId16, "INT16_MIN", INT16_MIN );
printf( " %-18s %-9s %-13s %" PRId16 "\n",
"", "", "INT16_MAX", INT16_MAX );

printf( " %-18s %-9s %-13s %" PRId32 "\n",
"int32_t", PRId32, "INT32_MIN", INT32_MIN );
printf( " %-18s %-9s %-13s %" PRId32 "\n",
"", "", "INT32_MAX", INT32_MAX );

#if defined(INT64_MIN)
printf( " %-18s %-9s %-13s %" PRId64 "\n",
"int64_t", PRId64, "INT64_MIN", INT64_MIN );
printf( " %-18s %-9s %-13s %" PRId64 "\n",
"", "", "INT64_MAX", INT64_MAX );
#endif

printf( " %-18s %-9s %-13s %" PRIu8 "\n",
"uint8_t", PRIu8, "UINT8_MAX", UINT8_MAX );
printf( " %-18s %-9s %-13s %" PRIu16 "\n",
"uint16_t", PRIu16, "UINT16_MAX", UINT16_MAX );
printf( " %-18s %-9s %-13s %" PRIu32 "\n",
"uint32_t", PRIu32, "UINT32_MAX", UINT32_MAX );
#if defined(UINT64_MAX)
printf( " %-18s %-9s %-13s %" PRIu64 "\n",
"uint64_t", PRIu64, "UINT64_MAX", UINT64_MAX );
#endif

printf( " %-18s %-9s %-13s %" PRIdMAX "\n",
"intmax_t", PRIdMAX, "INTMAX_MIN", INTMAX_MIN );
printf( " %-18s %-9s %-13s %" PRIdMAX "\n",
"", "", "INTMAX_MAX", INTMAX_MAX );
printf( " %-18s %-9s %-13s %" PRIuMAX "\n",
"uintmax_t", PRIuMAX, "UINTMAX_MAX", UINTMAX_MAX );

#if defined(LLONG_MAX)
printf( " %-18s %-9s %-13s %" "lld" "\n",
"long long", "lld", "LLONG_MIN", LLONG_MIN );
printf( " %-18s %-9s %-13s %" "lld" "\n",
"", "", "LLONG_MAX", LLONG_MAX );
printf( " %-18s %-9s %-13s %" "llu" "\n",
"unsigned long long", "llu", "ULLONG_MAX", ULLONG_MAX );
#endif

printf( " %-18s %-9s %-13s %zu\n",
"size_t", "zu", "SIZE_MAX", SIZE_MAX );
printf( " %-18s %-9s %-13s %td\n",
"ptrdiff_t", "td", "PTRDIFF_MIN", PTRDIFF_MIN );
printf( " %-18s %-9s %-13s %td\n",
"", "", "PTRDIFF_MAX", PTRDIFF_MAX );

return 0;
}
\endcode

Before, I would get incorrect results for zu, td, llu and lld. Now
they seem to be working.


------------------------------------------------------------------------
| type | specifier | limit |
value |

------------------------------------------------------------------------
int8_t d INT8_MIN -128
INT8_MAX 127
int16_t d INT16_MIN -32768
INT16_MAX 32767
int32_t d INT32_MIN -2147483648
INT32_MAX 2147483647
int64_t I64d INT64_MIN
-9223372036854775808
INT64_MAX 9223372036854775807
uint8_t u UINT8_MAX 255
uint16_t u UINT16_MAX 65535
uint32_t u UINT32_MAX 4294967295
uint64_t I64u UINT64_MAX
18446744073709551615
intmax_t I64d INTMAX_MIN
-9223372036854775808
INTMAX_MAX 9223372036854775807
uintmax_t I64u UINTMAX_MAX
18446744073709551615
long long lld LLONG_MIN
-9223372036854775808
LLONG_MAX 9223372036854775807
unsigned long long llu ULLONG_MAX
18446744073709551615
size_t zu SIZE_MAX 4294967295
ptrdiff_t td PTRDIFF_MIN -2147483648
PTRDIFF_MAX 2147483647

Best regards,
John D.
 
J

Jo

jacob said:
Le 13/11/11 05:43, ankh a écrit :

And you mean what by that sentence? What "song"? Who is "jake"?

You are not good at what you want to do. You should change careers. You
are ineffectual and can't program yourself out of a paper bag (nor write
about it). Just a thought. Maybe some extrospection was in order, but you
can't seem to help yourself to save your own life or even leave a gleam
of it on this planet, so I thought I'd try to help you a bit.
 
B

BartC

Jo said:
jacob navia wrote:

You are not good at what you want to do. You should change careers. You
are ineffectual and can't program yourself out of a paper bag (nor write
about it). Just a thought.

No. Someone writes some software with a million downloads, but of course
they are not good programmers! How many downloads do you have?
 
F

Fritz Wuehler

BartC said:
No. Someone writes some software with a million downloads, but of course
they are not good programmers! How many downloads do you have?

Good marketing = good programmer? What does the number of downloads have to
do with anything?

I hope your desktop is Windows and your phone is an iPhone.

I have navia killfiled but your statement is a ludicrous fallacy.
 
J

Jo

BartC said:
No. Someone writes some software with a million downloads, but of
course they are not good programmers! How many downloads do you have?

You said it just right Bart. About your "human virus" existence, that is.
Hello. What your mommie and daddie never told you, no could they, huh.
You want to be "liked" maybe. Did I make someone think? That's bad huh.
There is a quip on this board that goes something like: "make them think
they are <whatever>, you are golden. Make them think, they will hate
you". Something like that. Is it your turn to call me a narcissist? Bring
it, I dare you. I'm not calling you stupid, I just do that on the
internet. :p
 
J

Jo

Fritz said:
Good marketing = good programmer? What does the number of downloads
have to do with anything?

That kind of thing annoys me totally. That anyone would think that anyone
else would be so fucking stupid as to fall for well-known bullshit. THIS,
really irks me. Makes me mad as hell. (Not that I am religious or suggest
that some fucking stupid concept like that could be mad..... pfft).
I hope your desktop is Windows and your phone is an iPhone.

I know you were tallking to him (Jake, not you as "him", you creep), but
mine is. It causes me to get really drunk and lament here. Yes, Windows
is like, well, it's not "like" that at all... Windows is my own and
personal, "wheel of pain". And you fucking know it.
I have navia killfiled but your statement is a ludicrous fallacy.

You shouldn't "bozo bin" anyone ever probably, unless they become
bot-ish. IMO. I made no statement. I was just poking fun at him. He knows
he can't hang. He doesn't need you to tell me that he can't, which you
did. (I am soooo bad!!!!).
 
B

Brian

No. Someone writes some software with a million downloads, but of course
they are not good programmers! How many downloads do you have?

Sorry, but this is factually wrong.

Navia did not write the software. He bought the source code to lcc and
the rights to exploit it commercially.

He has added almost nothing of value to it: only an ugly GUI and a few
non-standard proprietary language additions that are useless to anyone
who wants to write portable code.
 
J

James Kuyper

On 11/22/2011 11:47 AM, Brian wrote:
....
Navia did not write the software. He bought the source code to lcc and
the rights to exploit it commercially.

He has added almost nothing of value to it: only an ugly GUI and a few
non-standard proprietary language additions that are useless to anyone
who wants to write portable code.

But there's apparently a lot of people who don't care about portable
code, and who like his non-standard additions a lot better than you or I
would.

Are his extensions proprietary? He's frequently recommended that they be
standardized. I'm not a lawyer, but it seems to me that if they are
indeed proprietary, he would have to hand over the intellectual property
rights to ISO in order for ISO to be able to incorporate them into a
future standard.
 
R

Richard Sanders

Navia did not write the software. He bought the source code to lcc and
the rights to exploit it commercially.
https://github.com/drh/lcc/blob/master/CPYRIGHT


He has added almost nothing of value to it: only an ugly GUI and a few
non-standard proprietary language additions that are useless to anyone
who wants to write portable code.

I was happy with LCC-Win until I started to use FLTK that requires
C++. I found the IDE to be clean without a whole bunch of (dockable)
windows reducing screen realestate. I wish MinGw compiled as fast as
LCC-Win.

As for "proprietary language additions". You are not compelled to use
these non portable additions, they are purly optional.
 
J

jacob navia

Le 22/11/11 17:47, Brian a écrit :
rry, but this is factually wrong.
Navia did not write the software. He bought the source code to lcc and
the rights to exploit it commercially.

This is not true.

I have written for the compiler:

o The optimizer (Code of lcc-win is faster than plain lcc)
o New types supported like long double and long long.
o Ported the code generator to the new CPUs. XMM extensions of
the x86 CPU.
o Countless fixes and improvements during years of work.
o The assembler. Plain lcc generates ascii. Lcc-win writes object files.
o The linker. Plain lcc has no linker.
o The IDE.
o The debugger.
o The resource editor.
o The make and project handling utility.
He has added almost nothing of value to it: only an ugly GUI and a few
non-standard proprietary language additions that are useless to anyone
who wants to write portable code.

lcc-win is C99. I wrote all necessary modifications to the compiler and
I wrote entirely the C99 C library.

But for these people, no lie will be enough.
 
J

jacob navia

Le 22/11/11 18:10, James Kuyper a écrit :
On 11/22/2011 11:47 AM, Brian wrote:
...

But there's apparently a lot of people who don't care about portable
code, and who like his non-standard additions a lot better than you or I
would.

Specially people that like 120 digits precision floats that can be used
with the same easy than normal doubles in C. Lcc-win has many
engineering applications.

The JIT compiler is popular among software that generates C.
Are his extensions proprietary?
No.

He's frequently recommended that they be
standardized.

Yes. That would be stupid if they were propietary...
I'm not a lawyer, but it seems to me that if they are
indeed proprietary, he would have to hand over the intellectual property
rights to ISO in order for ISO to be able to incorporate them into a
future standard.

My extensions can be copyrighted as propietary. Please, not everyone
here has this american habit of software patents (Amazon patented
the "one click" button... Apple patented the desktop, whatever). I
haven't any patent pending.

And you know that Mr Kuyper.
 
F

Friedrich Dominicus

Brian said:
He has added almost nothing of value to it: only an ugly GUI and a few
non-standard proprietary language additions that are useless to anyone
who wants to write portable code.
You have not the slightest idea, but well you're not alone with that.
 
M

Malcolm McLean

You have  not the slightest idea, but well you're not  alone with that.
Not all code has to be portable. If you add something of value to a C
compiler, really you have to add a non-standard feature. Otherwise
your compiler isn't much different from anyone else's and there's no
reason to choose it.

It seems that Jacob will be criticised either way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top