Re: turning Marsaglia's recent posts into a function



On 09/ 2/10 11:08 AM, Uno wrote:
Ian Collins wrote:
On 09/ 1/10 12:42 PM, Uno wrote:

$ gcc -Wall -Wextra geo1.c -o out
geo1.c: In function ‘MWC’:
geo1.c:5: warning: type defaults to ‘int’ in declaration of ‘c’
geo1.c:5: warning: type defaults to ‘int’ in declaration of ‘j’
geo1.c:5: warning: unused variable ‘i’
geo1.c: In function ‘main’:
geo1.c:21: warning: format ‘%22u’ expects type ‘unsigned int’, but
argument 2 has type ‘long unsigned int’
geo1.c:23: warning: format ‘%22u’ expects type ‘unsigned int’, but
argument 2 has type ‘long unsigned int’
geo1.c:24: warning: control reaches end of non-void function

A list of compiler warnings for some truly awful code.


These things look very fixable to me. George is 86, so he remembers a
more traditional C and has forgotten more about making random numbers
than we'll ever know.

I don't think he reads clc, but do you think your tone appropriate?

Yes.

unsigned long t,x,i; static c=0,j=4691;

is an abomination.

Passing the wrong types to printf is a bug.

--
Ian Collins
.



Relevant Pages

  • Re: MIXER sample
    ... > uno last question if i might....SetMute works to set mute ON, ... I noticed that you introduced a bug in the SetMute when you translated it ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: faq 19.1
    ... On 06/28/10 01:26 PM, Uno wrote: ... int tty_getchar ... you have a misbehaving terminal emulator or curses library. ... Ian Collins ...
    (comp.lang.c)
  • Re: To assert or not to assert...
    ... On 04/27/10 07:21 PM, Uno wrote: ... source for the standard c library. ... I recommend the book. ... Ian Collins ...
    (comp.lang.c)
  • Re: if you had a C gnome ...
    ... On 08/12/10 12:06 PM, Uno wrote: ... getting the types correct or the keystrokes? ... Ian Collins ...
    (comp.lang.c)