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
.