[Info-vax] Significance of 2020 / 2021 date
Bill Gunshannon
bill.gunshannon at gmail.com
Sat Jan 9 08:27:17 EST 2021
On 1/9/21 7:35 AM, Andy Burns wrote:
> Chris wrote:
>
>> issinoho wrote:
>>
>>> if (atoi (date_string + 5)> 2020)
>>
>> That code is type unsafe for starters. atoi() requires an ascii string,
>> but you are trying to add 5 decimal to an ascii string ?.
>
> atoi requires a *pointer* to an asciiz string, presumably in this case
> the format is something like DDMMMYYYY, so that the +5 starts the
> decimal conversion from the address of the first Y.
>
Am I the only one who things this was fat fingered and the example
should really be: if ((atoi (date_string) + 5) > 2020)
I would have expected the original to generate an error at compile
time.
bill
More information about the Info-vax
mailing list