Path: utzoo!mnetor!uunet!husc6!bloom-beacon!gatech!hao!noao!arizona!naucse!jdc From: jdc@naucse.UUCP (John Campbell) Newsgroups: comp.lang.c Subject: Old-fashioned Initialization Message-ID: <560@naucse.UUCP> Date: 8 Feb 88 17:34:10 GMT Organization: Northern Arizona University, Flagstaff, AZ Lines: 25 Keywords: Compiler nasties, Sleeping Bugs Do all bugs bite? This short program ran under unix on a 3b1 (and Ultrix). On VMS but it failed because I forgot =- is an "old-fashioned" initialization (I was in a hurry :-). In hindsight, my 3b1, did the same, but "x" was 0. On VMS x is 0 in the debugger--otherwise it's garbage. Neither VMS or the 3b1 said a thing about this section of code! My third try, on Ultrix, warned: line 6: warning: ambiguous assignment: assignment op taken line 6: warning: old fashioned assignment operator Lint (which I don't have on VMS) added: line 6: warning: x be used before set. So, two out of three compilers agree--give the user a quiet history lesson! (Is =- in dpAns 'C'?) (Are warning messages so awful?) #include #define PI 3.14159265 main () { float x; for (x=-3*PI; x < 3*PI; x += PI/8.0) /* Change to x = -3*PI */ printf ("%f %f\n", x, sin(x)/x); } -- John Campbell ...!arizona!naucse!jdc unix? Sure send me a dozen, all different colors.