Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!igor!rutabaga!jls From: jls@rutabaga.Rational.COM (Jim Showalter) Newsgroups: comp.object Subject: Re: Documenting OO Systems Keywords: operators Message-ID: Date: 2 Apr 91 04:42:31 GMT References: <299@orbit.gtephx.UUCP> <1991Mar25.145441.1@happy.colorado.edu> <20106@alice.att.com> <3481@engadm3.csd.mot.com> <1991Mar26.191259.14470@i88.isc.com> <4693@osc.COM> 12) return 0; %int leap = !(year%4) && year&400; %if (day<1 || day>(month_days[month-1] + (month==2 && year))) return 0; %int dayofmonth = 0; %for (int i=0; i2 && year); %} THIS is readable? I think the problem is more deeply rooted in the C culture than I thought... (this would garner one of my Ada students a D minus) %It becomes immediately apparent not %only what the function is supposed to do, but that it contains at %least one error (surely you meant to check (month==2 && leap)). Yep, you found one of the planted bugs. Now find the other. P.S. For all those who said what this function does is calculate the Julian date: wrong. What it is SUPPOSED to do is calculate the Julian date. What it actually does is produce erroneous results. This might have been easier to see if it had been written better. -- ***** DISCLAIMER: The opinions expressed herein are my own, except in the realm of software engineering, in which case I've borrowed them from incredibly smart people.