OT: Requesting C advice

Andy Green andy at warmcat.com
Thu May 31 10:47:37 UTC 2007


Mike McCarty wrote:
> Les wrote:
>> On Wed, 2007-05-30 at 15:34 -0500, Mike McCarty wrote:
> 
> [snip]
> 
>>> Plauger and I exchanged a few e-mails during that period, and
>>> he made comments of a similar nature. I got to meet him over
>>> on comp.lang.c 'way back. I'm sure he doesn't remember me, though.
>>
>> I am somewhat jealous of your getting to know Plauger.  I did implement
> 
> Don't be. We exchanged perhaps eight e-mails (eight from each of us,
> that is). Chalk that up more to his willingness to exchange emails with
> people that he doesn't know than anything else. He was very polite and
> seemed to listen to my comments.
> 
>> PASCAL from the diagrams in the back of the book, and it took some time
>> to do it.  I was working on a CPM based system by then, and only had one
>> single density hardsectored disk drive from Northstar.  It took a while.
> 
> I bet it did. I ran on a single floppy PCDOS machine for quite a while.
> I booted and loaded my software into a RAMDISC and then put another
> floppy in for data. I needed a copy of COMMAND.COM on both discs, so
> when the CI needed to be reloaded, I didn't have to swap floppy discs.
> 
> I implemented my first RTOS using a dual 8" floppy system with an 8085
> uP and 64K total RAM+ROM using CP/M. All written in RMAC.
> 
> [snip]
> 
>> expressive.  It was truly inspired.  I have used other languages, from
>> BASIC to APL (which is probably the most arcane you can get) and even
>> Cyber systems, but I prefer the simple elegance and efficiency of C
>> whenever possible.
> 
> First machine I programmed was an IBM 1401 using machine language.
> Then came an IBM System/360 running APL. Then came a CYBER 6000 using
> machine language again. Then a Fairchild F8 with machine language.
> 
>>     I also remember the big-endian vs little-endian arguments, and some
>> of the consternation that caused.  And the arguments about re-entrant
>> code, and variable wipes.  C never initializes, so there was a huge
> 
> C doesn't initialize what? It initializes all used variables.

Not if they're on the stack.  You should get a compiler warning
nowadays... but don't count on it!

#include <stdio.h>

int main()
{
	int a;

	printf("%d\n", a);

	return 0;
}

$ gcc -Wall test.c
$ ./a.out
6874720
$ ./a.out
9766496
$ gcc --version
gcc (GCC) 4.1.2 20070502 (Red Hat 4.1.2-12)

-Andy




More information about the fedora-list mailing list