Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Error in operator: add beer


devel / comp.std.c / Re: C23: asctime is obsolescent

SubjectAuthor
* C23: asctime is obsolescentTim Rentsch
`* C23: asctime is obsolescentKeith Thompson
 `* C23: asctime is obsolescentTim Rentsch
  `* C23: asctime is obsolescentKeith Thompson
   +* C23: asctime is obsolescentJakob Bohm
   |`* C23: asctime is obsolescentKeith Thompson
   | `* C23: asctime is obsolescentJakob Bohm
   |  `- C23: asctime is obsolescentPete Forman
   `- C23: asctime is obsolescentTim Rentsch

1
Re: C23: asctime is obsolescent

<86h6pyzewi.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=520&group=comp.std.c#520

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.std.c
Subject: Re: C23: asctime is obsolescent
Date: Thu, 20 Jul 2023 10:11:41 -0700
Organization: A noiseless patient Spider
Lines: 88
Message-ID: <86h6pyzewi.fsf@linuxsc.com>
References: <875yf5ksn9.fsf@nosuchdomain.example.com> <861qocrk5b.fsf@linuxsc.com> <IeEsL.27470$cKvc.4521@fx42.iad> <867cx5gpgo.fsf@linuxsc.com> <874js8j18h.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="3857442d865f8a7bff3454fde02b814b";
logging-data="2949588"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/m4g3uqOicgwiK56V1GdVqzwLGp1jIhWs="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:5QJjQ4jnrlOvEz3NGBG2gEbbrmI=
sha1:lkEYvXY0nJ89LsPBiow7G/qylzc=
 by: Tim Rentsch - Thu, 20 Jul 2023 17:11 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> Richard Damon <Richard@Damon-Family.org> writes:
>>
>>> On 1/2/23 11:11 AM, Tim Rentsch wrote:
>>>
>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>>
>>>>> In the latest C23 draft:
>>>>> https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf
>>>>> the descriptions of the __DATE__ and __TIME__ macros refer to the
>>>>> asctime() function.
>>>>>
>>>>> That's not new. What's new is that asctime() is deprecated.
>>>>>
>>>>> Referring to a deprecated function isn't really a problem, but if
>>>>> asctime() is actually removed in a future standard the descriptions of
>>>>> __DATE__ and __TIME__ will need to be updated.
>>>>>
>>>>> It would also be nice to have a new macro that expands to the current
>>>>> date in the form "YYYY-MM-DD". I do not suggest changing the behavior
>>>>> of __DATE__, but perhaps something like __ISODATE__ could be added.
>>>>> Question: If this is done, should __DATE__ be deprecated?
>>>>
>>>> It seems pointless to add __ISODATE__ if __DATE__ is retained, and
>>>> worse than pointless to add __ISODATE__ and then remove __DATE__.
>>>
>>> Why? What is wrong with having macros to get a value in different
>>> formats. Different applications may well want either one.
>>
>> To my way of thinking, the symbol __DATE__ is defined in an ISO
>> document, so it already qualifies as an ISO date. To have
>> another symbol named __ISODATE__ is redundant if it means the
>> same thing as __DATE__, or confusing if it means something
>> different. If it's important to have a symbol for a different
>> format defined in some other ISO standard, the symbol name should
>> include some indication of where the format comes from, in a
>> similar manner to __STDC_IEC_559__, for example.
>>
>>> Almost all my programs currently use __DATE__ (and __TIME__) to embed
>>> build information into the program. I could see applications where
>>> having the ISO formatted date would be useful, as it has some very
>>> useful properties (like sortability)
>>
>> I'm okay with having another date format. I just don't think the
>> symbol that gives it should be named __ISODATE__, because that's
>> confusing.
>
> The format is from ISO 8601, but I would oppose calling the new macro
> __ISO_8601_DATE__, because longer and more difficult to remember. My
> intent is to provide an *easy* way to embed the compilation date as a
> string in an executable in a reasonable format. Inserting "_8601_" into
> the name doesn't add sufficient value, and __ISODATE__ is sufficiently
> clear. And it's perfectly possible for the C standard to refer to a
> YYYY-MM-DD format without mentioning the ISO 8601 standard.
>
> The only reason to keep the current __DATE__ in the standard is backward
> compatibility (and yes, that's an *extremely* compelling reason). If I
> were adding this to a new language, there would just be a __DATE__ macro
> that expands to "YYYY-MM-DD"; it would never occur to me to build
> something into the language that expands to "Mmm DD YYYY". Adding "ISO"
> to the new name is a concession to backward compatibility.
>
> Not every name has to describe its origin, and nobody seeing the name
> __ISODATE__ is going to think that the ISO standard it refers to is the
> ISO C standard. I disagree with your assertion that it would be
> confusing.
>
> And if your problem with the name __ISODATE__ is the "ISO" is confusing,
> you could have said that in the first place.

To do that I would have had to have known that I was confused,
which I didn't.

> Do you have a suggestion for a better name?

Yes, a more explicit one, including a numeric indicator of
which ISO standard it's from (and it's likely there is more
than one possibility).

I consulted with someone whose job it is to ensure ISO
compliance in an industry that takes ISO compliance
seriously, and she absolutely agreed with this reaction.
These markers should ALWAYS be explicit. Ambiguity is
the enemy. I would think that you of all people would
agree with this position.

Re: C23: asctime is obsolescent

<87351is0i5.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=523&group=comp.std.c#523

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.std.c
Subject: Re: C23: asctime is obsolescent
Date: Thu, 20 Jul 2023 15:04:34 -0700
Organization: None to speak of
Lines: 111
Message-ID: <87351is0i5.fsf@nosuchdomain.example.com>
References: <875yf5ksn9.fsf@nosuchdomain.example.com>
<861qocrk5b.fsf@linuxsc.com> <IeEsL.27470$cKvc.4521@fx42.iad>
<867cx5gpgo.fsf@linuxsc.com> <874js8j18h.fsf@nosuchdomain.example.com>
<86h6pyzewi.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="2370f913b850030e0527dd0f7396627d";
logging-data="3049108"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cjbUlZ/mgLF+DDX/lq3IY"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:uIJfgijkVemN01X134A94Sfo46Y=
sha1:l09zEMmwEjwUd1aVMQFGDs0VbAI=
 by: Keith Thompson - Thu, 20 Jul 2023 22:04 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>> Richard Damon <Richard@Damon-Family.org> writes:
>>>> On 1/2/23 11:11 AM, Tim Rentsch wrote:
>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>>>> In the latest C23 draft:
>>>>>> https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf
>>>>>> the descriptions of the __DATE__ and __TIME__ macros refer to the
>>>>>> asctime() function.
>>>>>>
>>>>>> That's not new. What's new is that asctime() is deprecated.
>>>>>>
>>>>>> Referring to a deprecated function isn't really a problem, but if
>>>>>> asctime() is actually removed in a future standard the descriptions of
>>>>>> __DATE__ and __TIME__ will need to be updated.
>>>>>>
>>>>>> It would also be nice to have a new macro that expands to the current
>>>>>> date in the form "YYYY-MM-DD". I do not suggest changing the behavior
>>>>>> of __DATE__, but perhaps something like __ISODATE__ could be added.
>>>>>> Question: If this is done, should __DATE__ be deprecated?
>>>>>
>>>>> It seems pointless to add __ISODATE__ if __DATE__ is retained, and
>>>>> worse than pointless to add __ISODATE__ and then remove __DATE__.
>>>>
>>>> Why? What is wrong with having macros to get a value in different
>>>> formats. Different applications may well want either one.
>>>
>>> To my way of thinking, the symbol __DATE__ is defined in an ISO
>>> document, so it already qualifies as an ISO date. To have
>>> another symbol named __ISODATE__ is redundant if it means the
>>> same thing as __DATE__, or confusing if it means something
>>> different. If it's important to have a symbol for a different
>>> format defined in some other ISO standard, the symbol name should
>>> include some indication of where the format comes from, in a
>>> similar manner to __STDC_IEC_559__, for example.
>>>
>>>> Almost all my programs currently use __DATE__ (and __TIME__) to embed
>>>> build information into the program. I could see applications where
>>>> having the ISO formatted date would be useful, as it has some very
>>>> useful properties (like sortability)
>>>
>>> I'm okay with having another date format. I just don't think the
>>> symbol that gives it should be named __ISODATE__, because that's
>>> confusing.
>>
>> The format is from ISO 8601, but I would oppose calling the new macro
>> __ISO_8601_DATE__, because longer and more difficult to remember. My
>> intent is to provide an *easy* way to embed the compilation date as a
>> string in an executable in a reasonable format. Inserting "_8601_" into
>> the name doesn't add sufficient value, and __ISODATE__ is sufficiently
>> clear. And it's perfectly possible for the C standard to refer to a
>> YYYY-MM-DD format without mentioning the ISO 8601 standard.
>>
>> The only reason to keep the current __DATE__ in the standard is backward
>> compatibility (and yes, that's an *extremely* compelling reason). If I
>> were adding this to a new language, there would just be a __DATE__ macro
>> that expands to "YYYY-MM-DD"; it would never occur to me to build
>> something into the language that expands to "Mmm DD YYYY". Adding "ISO"
>> to the new name is a concession to backward compatibility.
>>
>> Not every name has to describe its origin, and nobody seeing the name
>> __ISODATE__ is going to think that the ISO standard it refers to is the
>> ISO C standard. I disagree with your assertion that it would be
>> confusing.
>>
>> And if your problem with the name __ISODATE__ is the "ISO" is confusing,
>> you could have said that in the first place.
>
> To do that I would have had to have known that I was confused,
> which I didn't.

Are you saying that you weren't confused, or that you were confused and
didn't know it?

>> Do you have a suggestion for a better name?
>
> Yes, a more explicit one, including a numeric indicator of
> which ISO standard it's from (and it's likely there is more
> than one possibility).

You're replying to something I wrote about six months ago. When I
asked whether you have a suggestion, I was also implicitly asking
what your suggestion is. Perhaps you'll let us know before the
end of the year.

> I consulted with someone whose job it is to ensure ISO
> compliance in an industry that takes ISO compliance
> seriously, and she absolutely agreed with this reaction.
> These markers should ALWAYS be explicit. Ambiguity is
> the enemy. I would think that you of all people would
> agree with this position.

Names don't have to be fully descriptive. "size_t" doesn't say that
the size is measured in bytes, or that the "t" stands for "type".
It doesn't have to. The meaning is specified in the standard.

I already gave my reasons for not wanting the proposed new name to
be "__ISO_8601_DATE__". All I'm looking for is something that's
reasonably clear and distinct from "__DATE__".

If such a symbol were added, the standard would have to describe
its semantics precisely, with or without referring to the ISO
8601 standard.

I'd also be happy with a name like "__YYYYMMDD__" or "__YMD__".

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: C23: asctime is obsolescent

<865y5i8tqc.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=550&group=comp.std.c#550

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.std.c
Subject: Re: C23: asctime is obsolescent
Date: Sun, 13 Aug 2023 15:26:03 -0700
Organization: A noiseless patient Spider
Lines: 154
Message-ID: <865y5i8tqc.fsf@linuxsc.com>
References: <875yf5ksn9.fsf@nosuchdomain.example.com> <861qocrk5b.fsf@linuxsc.com> <IeEsL.27470$cKvc.4521@fx42.iad> <867cx5gpgo.fsf@linuxsc.com> <874js8j18h.fsf@nosuchdomain.example.com> <86h6pyzewi.fsf@linuxsc.com> <87351is0i5.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="43370f569e8ab1d7fa987214319e42b9";
logging-data="2098105"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+K6zWfDrcT10ltup5LgXaWN/0IbxdBo0Q="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:bmx3ow+GccAndIvWECw+wbZiqYc=
sha1:XCfMMVrOGorTy9EX26XDUpqERTA=
 by: Tim Rentsch - Sun, 13 Aug 2023 22:26 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>
>>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>>
>>>> Richard Damon <Richard@Damon-Family.org> writes:
>>>>
>>>>> On 1/2/23 11:11 AM, Tim Rentsch wrote:
>>>>>
>>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>>>>
>>>>>>> In the latest C23 draft:
>>>>>>> https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf the
>>>>>>> descriptions of the __DATE__ and __TIME__ macros refer to the
>>>>>>> asctime() function.
>>>>>>>
>>>>>>> That's not new. What's new is that asctime() is deprecated.
>>>>>>>
>>>>>>> Referring to a deprecated function isn't really a problem, but
>>>>>>> if asctime() is actually removed in a future standard the
>>>>>>> descriptions of __DATE__ and __TIME__ will need to be updated.
>>>>>>>
>>>>>>> It would also be nice to have a new macro that expands to the
>>>>>>> current date in the form "YYYY-MM-DD". I do not suggest
>>>>>>> changing the behavior of __DATE__, but perhaps something like
>>>>>>> __ISODATE__ could be added. Question: If this is done,
>>>>>>> should __DATE__ be deprecated?
>>>>>>
>>>>>> It seems pointless to add __ISODATE__ if __DATE__ is retained,
>>>>>> and worse than pointless to add __ISODATE__ and then remove
>>>>>> __DATE__.
>>>>>
>>>>> Why? What is wrong with having macros to get a value in
>>>>> different formats. Different applications may well want either
>>>>> one.
>>>>
>>>> To my way of thinking, the symbol __DATE__ is defined in an ISO
>>>> document, so it already qualifies as an ISO date. To have
>>>> another symbol named __ISODATE__ is redundant if it means the
>>>> same thing as __DATE__, or confusing if it means something
>>>> different. If it's important to have a symbol for a different
>>>> format defined in some other ISO standard, the symbol name should
>>>> include some indication of where the format comes from, in a
>>>> similar manner to __STDC_IEC_559__, for example.
>>>>
>>>>> Almost all my programs currently use __DATE__ (and __TIME__) to
>>>>> embed build information into the program. I could see
>>>>> applications where having the ISO formatted date would be
>>>>> useful, as it has some very useful properties (like sortability)
>>>>
>>>> I'm okay with having another date format. I just don't think the
>>>> symbol that gives it should be named __ISODATE__, because that's
>>>> confusing.
>>>
>>> The format is from ISO 8601, but I would oppose calling the new
>>> macro __ISO_8601_DATE__, because longer and more difficult to
>>> remember. My intent is to provide an *easy* way to embed the
>>> compilation date as a string in an executable in a reasonable
>>> format. Inserting "_8601_" into the name doesn't add sufficient
>>> value, and __ISODATE__ is sufficiently clear. And it's perfectly
>>> possible for the C standard to refer to a YYYY-MM-DD format
>>> without mentioning the ISO 8601 standard.
>>>
>>> The only reason to keep the current __DATE__ in the standard is
>>> backward compatibility (and yes, that's an *extremely* compelling
>>> reason). If I were adding this to a new language, there would
>>> just be a __DATE__ macro that expands to "YYYY-MM-DD"; it would
>>> never occur to me to build something into the language that
>>> expands to "Mmm DD YYYY". Adding "ISO" to the new name is a
>>> concession to backward compatibility.
>>>
>>> Not every name has to describe its origin, and nobody seeing the
>>> name __ISODATE__ is going to think that the ISO standard it refers
>>> to is the ISO C standard. I disagree with your assertion that it
>>> would be confusing.
>>>
>>> And if your problem with the name __ISODATE__ is the "ISO" is
>>> confusing, you could have said that in the first place.
>>
>> To do that I would have had to have known that I was confused,
>> which I didn't.
>
> Are you saying that you weren't confused, or that you were confused
> and didn't know it?

I wasn't confused. I was wrong, but I wasn't confused.

>>> Do you have a suggestion for a better name?
>>
>> Yes, a more explicit one, including a numeric indicator of
>> which ISO standard it's from (and it's likely there is more
>> than one possibility).
>
> You're replying to something I wrote about six months ago.

Yes, I'm sorry it took so long. It's been a hard year.

> When I asked whether you have a suggestion, I was also
> implicitly asking what your suggestion is. Perhaps you'll let
> us know before the end of the year.

I already gave a suggestion. I don't at this moment have enough
information to make that suggestion more specific.

>> I consulted with someone whose job it is to ensure ISO
>> compliance in an industry that takes ISO compliance
>> seriously, and she absolutely agreed with this reaction.
>> These markers should ALWAYS be explicit. Ambiguity is
>> the enemy. I would think that you of all people would
>> agree with this position.
>
> Names don't have to be fully descriptive. "size_t" doesn't say
> that the size is measured in bytes, or that the "t" stands for
> "type". It doesn't have to. The meaning is specified in the
> standard.

This case is one where I believe it would be prudent for the
particular ISO reference to be explicit in the name, and not just
given indirectly in text in the C standard.

> I already gave my reasons for not wanting the proposed new name
> to be "__ISO_8601_DATE__". All I'm looking for is something
> that's reasonably clear and distinct from "__DATE__".

Yes, I think I understand your reasoning. I don't share your
conclusions, as I have tried to explain.

> If such a symbol were added, the standard would have to
> describe its semantics precisely, with or without referring to
> the ISO 8601 standard.

If the generated date string is meant to conform to a particular
format defined in an ISO standard, then it seems like good
practice would dictate that a reference to the specific ISO
standard document should be given in the C standard, and also
listed as a normative reference.

> I'd also be happy with a name like "__YYYYMMDD__" or "__YMD__".

If the point, or at least part of the point, is to present a date
in a format that conforms to one given in an ISO standard, then
it seems a good idea to make that apparent in the name. In this
very particular case, more explicit is better.

And there is nothing stopping someone from using a #define'd
symbol

#define DATE_YYYYMMDD __ISO_8601_DATE__

if they want to use a name that is more directly descriptive and
perhaps easier to remember.

Re: C23: asctime is obsolescent

<87v8dimrmi.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=551&group=comp.std.c#551

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.std.c
Subject: Re: C23: asctime is obsolescent
Date: Sun, 13 Aug 2023 16:47:49 -0700
Organization: None to speak of
Lines: 188
Message-ID: <87v8dimrmi.fsf@nosuchdomain.example.com>
References: <875yf5ksn9.fsf@nosuchdomain.example.com>
<861qocrk5b.fsf@linuxsc.com> <IeEsL.27470$cKvc.4521@fx42.iad>
<867cx5gpgo.fsf@linuxsc.com> <874js8j18h.fsf@nosuchdomain.example.com>
<86h6pyzewi.fsf@linuxsc.com> <87351is0i5.fsf@nosuchdomain.example.com>
<865y5i8tqc.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="bc618e44e086a302991f1b359b3157e4";
logging-data="2115086"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18uheZhQSQrULbDA1u7vQwe"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:+PgJmsXB5r98eHuREu0qzIY9E1I=
sha1:dVguq2YvP1xX5Pw6f2MIleVSi1w=
 by: Keith Thompson - Sun, 13 Aug 2023 23:47 UTC

Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>>>> Richard Damon <Richard@Damon-Family.org> writes:
>>>>>> On 1/2/23 11:11 AM, Tim Rentsch wrote:
>>>>>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>>>>>> In the latest C23 draft:
>>>>>>>> https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf the
>>>>>>>> descriptions of the __DATE__ and __TIME__ macros refer to the
>>>>>>>> asctime() function.
>>>>>>>>
>>>>>>>> That's not new. What's new is that asctime() is deprecated.
>>>>>>>>
>>>>>>>> Referring to a deprecated function isn't really a problem, but
>>>>>>>> if asctime() is actually removed in a future standard the
>>>>>>>> descriptions of __DATE__ and __TIME__ will need to be updated.
>>>>>>>>
>>>>>>>> It would also be nice to have a new macro that expands to the
>>>>>>>> current date in the form "YYYY-MM-DD". I do not suggest
>>>>>>>> changing the behavior of __DATE__, but perhaps something like
>>>>>>>> __ISODATE__ could be added. Question: If this is done,
>>>>>>>> should __DATE__ be deprecated?
>>>>>>>
>>>>>>> It seems pointless to add __ISODATE__ if __DATE__ is retained,
>>>>>>> and worse than pointless to add __ISODATE__ and then remove
>>>>>>> __DATE__.
>>>>>>
>>>>>> Why? What is wrong with having macros to get a value in
>>>>>> different formats. Different applications may well want either
>>>>>> one.
>>>>>
>>>>> To my way of thinking, the symbol __DATE__ is defined in an ISO
>>>>> document, so it already qualifies as an ISO date. To have
>>>>> another symbol named __ISODATE__ is redundant if it means the
>>>>> same thing as __DATE__, or confusing if it means something
>>>>> different. If it's important to have a symbol for a different
>>>>> format defined in some other ISO standard, the symbol name should
>>>>> include some indication of where the format comes from, in a
>>>>> similar manner to __STDC_IEC_559__, for example.
>>>>>
>>>>>> Almost all my programs currently use __DATE__ (and __TIME__) to
>>>>>> embed build information into the program. I could see
>>>>>> applications where having the ISO formatted date would be
>>>>>> useful, as it has some very useful properties (like sortability)
>>>>>
>>>>> I'm okay with having another date format. I just don't think the
>>>>> symbol that gives it should be named __ISODATE__, because that's
>>>>> confusing.
>>>>
>>>> The format is from ISO 8601, but I would oppose calling the new
>>>> macro __ISO_8601_DATE__, because longer and more difficult to
>>>> remember. My intent is to provide an *easy* way to embed the
>>>> compilation date as a string in an executable in a reasonable
>>>> format. Inserting "_8601_" into the name doesn't add sufficient
>>>> value, and __ISODATE__ is sufficiently clear. And it's perfectly
>>>> possible for the C standard to refer to a YYYY-MM-DD format
>>>> without mentioning the ISO 8601 standard.
>>>>
>>>> The only reason to keep the current __DATE__ in the standard is
>>>> backward compatibility (and yes, that's an *extremely* compelling
>>>> reason). If I were adding this to a new language, there would
>>>> just be a __DATE__ macro that expands to "YYYY-MM-DD"; it would
>>>> never occur to me to build something into the language that
>>>> expands to "Mmm DD YYYY". Adding "ISO" to the new name is a
>>>> concession to backward compatibility.
>>>>
>>>> Not every name has to describe its origin, and nobody seeing the
>>>> name __ISODATE__ is going to think that the ISO standard it refers
>>>> to is the ISO C standard. I disagree with your assertion that it
>>>> would be confusing.
>>>>
>>>> And if your problem with the name __ISODATE__ is the "ISO" is
>>>> confusing, you could have said that in the first place.
>>>
>>> To do that I would have had to have known that I was confused,
>>> which I didn't.
>>
>> Are you saying that you weren't confused, or that you were confused
>> and didn't know it?
>
> I wasn't confused. I was wrong, but I wasn't confused.

I still don't know what you were wrong about.

>>>> Do you have a suggestion for a better name?
>>>
>>> Yes, a more explicit one, including a numeric indicator of
>>> which ISO standard it's from (and it's likely there is more
>>> than one possibility).
>>
>> You're replying to something I wrote about six months ago.
>
> Yes, I'm sorry it took so long. It's been a hard year.
>
>> When I asked whether you have a suggestion, I was also
>> implicitly asking what your suggestion is. Perhaps you'll let
>> us know before the end of the year.
>
> I already gave a suggestion. I don't at this moment have enough
> information to make that suggestion more specific.
>
>>> I consulted with someone whose job it is to ensure ISO
>>> compliance in an industry that takes ISO compliance
>>> seriously, and she absolutely agreed with this reaction.
>>> These markers should ALWAYS be explicit. Ambiguity is
>>> the enemy. I would think that you of all people would
>>> agree with this position.
>>
>> Names don't have to be fully descriptive. "size_t" doesn't say
>> that the size is measured in bytes, or that the "t" stands for
>> "type". It doesn't have to. The meaning is specified in the
>> standard.
>
> This case is one where I believe it would be prudent for the
> particular ISO reference to be explicit in the name, and not just
> given indirectly in text in the C standard.
>
>> I already gave my reasons for not wanting the proposed new name
>> to be "__ISO_8601_DATE__". All I'm looking for is something
>> that's reasonably clear and distinct from "__DATE__".
>
> Yes, I think I understand your reasoning. I don't share your
> conclusions, as I have tried to explain.
>
>> If such a symbol were added, the standard would have to
>> describe its semantics precisely, with or without referring to
>> the ISO 8601 standard.
>
> If the generated date string is meant to conform to a particular
> format defined in an ISO standard, then it seems like good
> practice would dictate that a reference to the specific ISO
> standard document should be given in the C standard, and also
> listed as a normative reference.
>
>> I'd also be happy with a name like "__YYYYMMDD__" or "__YMD__".
>
> If the point, or at least part of the point, is to present a date
> in a format that conforms to one given in an ISO standard, then
> it seems a good idea to make that apparent in the name. In this
> very particular case, more explicit is better.

I understand your opinion, and I disaagree. Certainly the standard can
refer specifically to the ISO 8601 standard, but I see no need for the
macro name to do so.

The point is to define a new macro that expands to a *better*
textual representation of the current date. (I could list a number
of reasons why "2023-08-13" is better than "Aug 13 2023".) The fact
that a particular ISO standard happens to define that representation
is incidental. If including "ISO" in the name without including
the ISO standard number is a problem (I don't think it is), there
are alternatives.

> And there is nothing stopping someone from using a #define'd
> symbol
>
> #define DATE_YYYYMMDD __ISO_8601_DATE__
>
> if they want to use a name that is more directly descriptive and
> perhaps easier to remember.


Click here to read the complete article
Re: C23: asctime is obsolescent

<V7GdnfKvQukw7EP5nZ2dnZeNn_Vj4p2d@giganews.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=563&group=comp.std.c#563

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!69.80.99.23.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 17 Aug 2023 19:14:53 +0000
Subject: Re: C23: asctime is obsolescent
Newsgroups: comp.std.c
References: <875yf5ksn9.fsf@nosuchdomain.example.com> <861qocrk5b.fsf@linuxsc.com> <IeEsL.27470$cKvc.4521@fx42.iad> <867cx5gpgo.fsf@linuxsc.com> <874js8j18h.fsf@nosuchdomain.example.com> <86h6pyzewi.fsf@linuxsc.com> <87351is0i5.fsf@nosuchdomain.example.com> <865y5i8tqc.fsf@linuxsc.com> <87v8dimrmi.fsf@nosuchdomain.example.com>
From: jb-usenet@wisemo.com.invalid (Jakob Bohm)
Organization: WiseMo A/S
Date: Thu, 17 Aug 2023 21:18:21 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:6.2) Goanna/20230604 Epyrus/2.0.2
MIME-Version: 1.0
In-Reply-To: <87v8dimrmi.fsf@nosuchdomain.example.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <V7GdnfKvQukw7EP5nZ2dnZeNn_Vj4p2d@giganews.com>
Lines: 71
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-ZKx/niLmdoYvSTAqyuWntQGwpvs+U2IcCgDR0wW+E5AxQUe5Gl82+LFW3LY0uYKULxD2+bmwARCuKLs!vrE1rmL4It9QhKzwtOHGt43aWTL85xPI+dX8dJWzKRxj4z16KLOcyV2nXvtSJhYVVWrZGBvuYqo=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 5164
 by: Jakob Bohm - Thu, 17 Aug 2023 19:18 UTC

On 2023-08-14 01:47, Keith Thompson wrote:
> ...
> I consider the proposed "8601" in the macro name to be cruft. I don't
> want to add more cruft to my code to avoid it. If it were defined as
> __ISO_8601_DATE__, I'd just use that.
>
> __DATE__ would be perfect if it weren't already taken.
>
> The names of the existing __DATE__ and __TIME__ macros don't describe
> what format they use (for example, that the month name in __DATE__ is in
> English and the fields are in a US-centric order), because they don't
> need to. A new macro that expands to "2023-08-13" doesn't need to
> either. Users of a hypothetical new standard will read the new
> specification and will know what it means without having to type the
> standard number again every time they use it.
>
> I like the name __ISODATE__ because ISO 8601 is *the* standard that
> defines date formats. I don't think there would be any confusion about
> which ISO standard is being referenced. (__TIME__ already conforms to
> ISO 8601). I'd accept __YYYMMDD__, but since __DATE__ isn't going away,
> I'd prefer something that suggests that it's closely related to
> __DATE__. Perhaps "__IDATE__".
>

Why __YYYMMDD__ (3 Ys, 2 Ms, 2 Ds). Why not simply __YMD__, which I
don't think is taken and is even shorter than __DATE__ .

For additional stability, add a rule in the standard that all 3
date/time macros must refer to the exact same point in time, which must
be within the system time tolerance of preprocessing the program source
code, possibly even during. For example, if the system only tracks the
time in centi-hours (36 seconds each) and preprocessing a particular C
program takes 0.1s starting at 2023-08-17T23:59:59, the timestamp
used for the macros may be 2023-08-17T23:59:24 or 2023-08-18T00:00:00 .

That additional rule above has been carefully written to allow all the
following 3 implementations:

OK1. When starting the preprocessor, detect the current date and time
in a way that doesn't suffer from race conditions, then use that
value throughout.

OK2. When first expanding either of the 3 macros, capture the
date/time value to be used, thus avoiding the I/O cost of doing so
when the program doesn't use the value.

OK3. When initiating the preprocessing of the program, the user or
build script specifies an exact date/time to be used by any
available means, such as command line arguments, environment
variables, a control file etc. This implementation is particularly
useful when trying to produce identical programs at different times
and places (so called reproducible builds).

But it doesn't allow the following bad implementations:

BAD1. Expand all 3 macros to the timestamp of the source file. This
would be inconsistent with past implementation practice.

BAD2. Capture the date or time every time either macro is expanded.
This causes a race condition if time crosses midnight during
preprocessing (The example above might end up returning
__YMD__ __TIME__ as "2023-08-17" "00:00:00"

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S. https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark. Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

Re: C23: asctime is obsolescent

<87ttsxjujd.fsf@nosuchdomain.example.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=564&group=comp.std.c#564

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.std.c
Subject: Re: C23: asctime is obsolescent
Date: Thu, 17 Aug 2023 13:14:30 -0700
Organization: None to speak of
Lines: 100
Message-ID: <87ttsxjujd.fsf@nosuchdomain.example.com>
References: <875yf5ksn9.fsf@nosuchdomain.example.com>
<861qocrk5b.fsf@linuxsc.com> <IeEsL.27470$cKvc.4521@fx42.iad>
<867cx5gpgo.fsf@linuxsc.com> <874js8j18h.fsf@nosuchdomain.example.com>
<86h6pyzewi.fsf@linuxsc.com> <87351is0i5.fsf@nosuchdomain.example.com>
<865y5i8tqc.fsf@linuxsc.com> <87v8dimrmi.fsf@nosuchdomain.example.com>
<V7GdnfKvQukw7EP5nZ2dnZeNn_Vj4p2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="b05999d425cd7ec276267a84f508b846";
logging-data="4108871"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ZCXTw8BMc2LvNiIn/jwL2"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:JbNUEnPHQY66IddX+G5JkYAgFBk=
sha1:JPDoj5SvjZeOuYXIIUApiP0DU7U=
 by: Keith Thompson - Thu, 17 Aug 2023 20:14 UTC

Jakob Bohm <jb-usenet@wisemo.com.invalid> writes:
> On 2023-08-14 01:47, Keith Thompson wrote:
>> ...
>> I consider the proposed "8601" in the macro name to be cruft. I don't
>> want to add more cruft to my code to avoid it. If it were defined as
>> __ISO_8601_DATE__, I'd just use that.
>> __DATE__ would be perfect if it weren't already taken.
>> The names of the existing __DATE__ and __TIME__ macros don't
>> describe
>> what format they use (for example, that the month name in __DATE__ is in
>> English and the fields are in a US-centric order), because they don't
>> need to. A new macro that expands to "2023-08-13" doesn't need to
>> either. Users of a hypothetical new standard will read the new
>> specification and will know what it means without having to type the
>> standard number again every time they use it.
>> I like the name __ISODATE__ because ISO 8601 is *the* standard that
>> defines date formats. I don't think there would be any confusion about
>> which ISO standard is being referenced. (__TIME__ already conforms to
>> ISO 8601). I'd accept __YYYMMDD__, but since __DATE__ isn't going away,
>> I'd prefer something that suggests that it's closely related to
>> __DATE__. Perhaps "__IDATE__".
>
> Why __YYYMMDD__ (3 Ys, 2 Ms, 2 Ds).

Just a typo. I meant __YYYYMMDD__.

> Why not simply __YMD__, which I
> don't think is taken and is even shorter than __DATE__ .

Yes, I mentioned __YMD__ in a previous post.

> For additional stability, add a rule in the standard that all 3
> date/time macros must refer to the exact same point in time, which must
> be within the system time tolerance of preprocessing the program source
> code, possibly even during. For example, if the system only tracks
> the time in centi-hours (36 seconds each) and preprocessing a
> particular C
> program takes 0.1s starting at 2023-08-17T23:59:59, the timestamp
> used for the macros may be 2023-08-17T23:59:24 or 2023-08-18T00:00:00 .
>
> That additional rule above has been carefully written to allow all the
> following 3 implementations:
>
> OK1. When starting the preprocessor, detect the current date and time
> in a way that doesn't suffer from race conditions, then use that
> value throughout.
>
> OK2. When first expanding either of the 3 macros, capture the
> date/time value to be used, thus avoiding the I/O cost of doing so
> when the program doesn't use the value.
>
> OK3. When initiating the preprocessing of the program, the user or
> build script specifies an exact date/time to be used by any
> available means, such as command line arguments, environment
> variables, a control file etc. This implementation is particularly
> useful when trying to produce identical programs at different times
> and places (so called reproducible builds).
>
> But it doesn't allow the following bad implementations:
>
> BAD1. Expand all 3 macros to the timestamp of the source file. This
> would be inconsistent with past implementation practice.
>
> BAD2. Capture the date or time every time either macro is expanded.
> This causes a race condition if time crosses midnight during
> preprocessing (The example above might end up returning
> __YMD__ __TIME__ as "2023-08-17" "00:00:00"

Frankly, I don't think all that is necessary.

The standard currently says:

__DATE__ The date of translation of the preprocessing translation unit:
a character string literal of the form "Mmm dd yyyy", where the
names of the months are the same as those generated by the
asctime function, and the first character of dd is a space
character if the value is less than 10. If the date of
translation is not available, an implementation-defined valid
date shall be supplied.
....
__TIME__ The time of translation of the preprocessing translation unit:
a character string literal of the form "hh:mm:ss" as in the
time generated by the asctime function. If the time of

I think the phrase "translation of the preprocessing translation unit"
excludes an implementation that expands to a date or time when the line
is reached, which avoids your BAD2 error crossing midnight.

Allowing the user to specify a time other than the current one would
arguably be non-conforming, though a lot of options are non-conforming.
And both gcc and clang already allow -D__DATE__=...

I don't think the part about the time being within the system time
tolerance is necessary. An implementation would have to go out of its
way not to do that anyway.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: C23: asctime is obsolescent

<0z-dnUFPU_BLNkP5nZ2dnZeNn_WdnZ2d@giganews.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=565&group=comp.std.c#565

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!69.80.99.23.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Thu, 17 Aug 2023 23:23:02 +0000
Subject: Re: C23: asctime is obsolescent
Newsgroups: comp.std.c
References: <875yf5ksn9.fsf@nosuchdomain.example.com> <861qocrk5b.fsf@linuxsc.com> <IeEsL.27470$cKvc.4521@fx42.iad> <867cx5gpgo.fsf@linuxsc.com> <874js8j18h.fsf@nosuchdomain.example.com> <86h6pyzewi.fsf@linuxsc.com> <87351is0i5.fsf@nosuchdomain.example.com> <865y5i8tqc.fsf@linuxsc.com> <87v8dimrmi.fsf@nosuchdomain.example.com> <V7GdnfKvQukw7EP5nZ2dnZeNn_Vj4p2d@giganews.com> <87ttsxjujd.fsf@nosuchdomain.example.com>
From: jb-usenet@wisemo.com.invalid (Jakob Bohm)
Organization: WiseMo A/S
Date: Fri, 18 Aug 2023 01:26:32 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:6.2) Goanna/20230604 Epyrus/2.0.2
MIME-Version: 1.0
In-Reply-To: <87ttsxjujd.fsf@nosuchdomain.example.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <0z-dnUFPU_BLNkP5nZ2dnZeNn_WdnZ2d@giganews.com>
Lines: 122
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-LLy4qSzwGlocr2FjDLnOmcSE7USBR2nBNJ6VFO1fvp92FBQBfrmH9BpxL0xrggItDCK3VeBB7+2wRmK!QcY20SW4nJ2ZNl2/Cgc//0B/Ru/gMZBSjiKT/Q+uL1kc4fRbTlp7eBO2Fmx3C/MaLhZNxgvfZR4=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Jakob Bohm - Thu, 17 Aug 2023 23:26 UTC

On 2023-08-17 22:14, Keith Thompson wrote:
> Jakob Bohm <jb-usenet@wisemo.com.invalid> writes:
>> On 2023-08-14 01:47, Keith Thompson wrote:
>>> ...
>>> I consider the proposed "8601" in the macro name to be cruft. I don't
>>> want to add more cruft to my code to avoid it. If it were defined as
>>> __ISO_8601_DATE__, I'd just use that.
>>> __DATE__ would be perfect if it weren't already taken.
>>> The names of the existing __DATE__ and __TIME__ macros don't
>>> describe
>>> what format they use (for example, that the month name in __DATE__ is in
>>> English and the fields are in a US-centric order), because they don't
>>> need to. A new macro that expands to "2023-08-13" doesn't need to
>>> either. Users of a hypothetical new standard will read the new
>>> specification and will know what it means without having to type the
>>> standard number again every time they use it.
>>> I like the name __ISODATE__ because ISO 8601 is *the* standard that
>>> defines date formats. I don't think there would be any confusion about
>>> which ISO standard is being referenced. (__TIME__ already conforms to
>>> ISO 8601). I'd accept __YYYMMDD__, but since __DATE__ isn't going away,
>>> I'd prefer something that suggests that it's closely related to
>>> __DATE__. Perhaps "__IDATE__".
>>
>> Why __YYYMMDD__ (3 Ys, 2 Ms, 2 Ds).
>
> Just a typo. I meant __YYYYMMDD__.
>
>> Why not simply __YMD__, which I
>> don't think is taken and is even shorter than __DATE__ .
>
> Yes, I mentioned __YMD__ in a previous post.
>
>> For additional stability, add a rule in the standard that all 3
>> date/time macros must refer to the exact same point in time, which must
>> be within the system time tolerance of preprocessing the program source
>> code, possibly even during. For example, if the system only tracks
>> the time in centi-hours (36 seconds each) and preprocessing a
>> particular C
>> program takes 0.1s starting at 2023-08-17T23:59:59, the timestamp
>> used for the macros may be 2023-08-17T23:59:24 or 2023-08-18T00:00:00 .
>>
>> That additional rule above has been carefully written to allow all the
>> following 3 implementations:
>>
>> OK1. When starting the preprocessor, detect the current date and time
>> in a way that doesn't suffer from race conditions, then use that
>> value throughout.
>>
>> OK2. When first expanding either of the 3 macros, capture the
>> date/time value to be used, thus avoiding the I/O cost of doing so
>> when the program doesn't use the value.
>>
>> OK3. When initiating the preprocessing of the program, the user or
>> build script specifies an exact date/time to be used by any
>> available means, such as command line arguments, environment
>> variables, a control file etc. This implementation is particularly
>> useful when trying to produce identical programs at different times
>> and places (so called reproducible builds).
>>
>> But it doesn't allow the following bad implementations:
>>
>> BAD1. Expand all 3 macros to the timestamp of the source file. This
>> would be inconsistent with past implementation practice.
>>
>> BAD2. Capture the date or time every time either macro is expanded.
>> This causes a race condition if time crosses midnight during
>> preprocessing (The example above might end up returning
>> __YMD__ __TIME__ as "2023-08-17" "00:00:00"
>
> Frankly, I don't think all that is necessary.
>
> The standard currently says:
>
> __DATE__ The date of translation of the preprocessing translation unit:
> a character string literal of the form "Mmm dd yyyy", where the
> names of the months are the same as those generated by the
> asctime function, and the first character of dd is a space
> character if the value is less than 10. If the date of
> translation is not available, an implementation-defined valid
> date shall be supplied.
> ...
> __TIME__ The time of translation of the preprocessing translation unit:
> a character string literal of the form "hh:mm:ss" as in the
> time generated by the asctime function. If the time of
>

Neither quote specifies that the values need to be consistent, nor
that a longer preprocessing time cannot cause an implementation to
provide values indicating when each occurrence is expanded.

> I think the phrase "translation of the preprocessing translation unit"
> excludes an implementation that expands to a date or time when the line
> is reached, which avoids your BAD2 error crossing midnight.
>
> Allowing the user to specify a time other than the current one would
> arguably be non-conforming, though a lot of options are non-conforming.
> And both gcc and clang already allow -D__DATE__=...
>
> I don't think the part about the time being within the system time
> tolerance is necessary. An implementation would have to go out of its
> way not to do that anyway.
>

The reference to system tolerance was intended as a relaxation to
dissuade implementations from going overboard in trying to get a
correct time, such as by artificially slowing down the preprocessor
to the clock advancement rate. Note that my OK3 implementation
wouldn't be strictly compliant, but could exist in a non-normative
note to inspire such non-normative behavior needed to ensure
compliance with security procedures that validate compilation by
independent recompilation of certified sources.

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S. https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark. Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

Re: C23: asctime is obsolescent

<ysfh6osuz23.fsf@gmail.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=575&group=comp.std.c#575

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: petef4+usenet@gmail.com (Pete Forman)
Newsgroups: comp.std.c
Subject: Re: C23: asctime is obsolescent
Date: Mon, 21 Aug 2023 17:42:44 +0100
Organization: A noiseless patient Spider
Lines: 125
Message-ID: <ysfh6osuz23.fsf@gmail.com>
References: <875yf5ksn9.fsf@nosuchdomain.example.com>
<861qocrk5b.fsf@linuxsc.com> <IeEsL.27470$cKvc.4521@fx42.iad>
<867cx5gpgo.fsf@linuxsc.com> <874js8j18h.fsf@nosuchdomain.example.com>
<86h6pyzewi.fsf@linuxsc.com> <87351is0i5.fsf@nosuchdomain.example.com>
<865y5i8tqc.fsf@linuxsc.com> <87v8dimrmi.fsf@nosuchdomain.example.com>
<V7GdnfKvQukw7EP5nZ2dnZeNn_Vj4p2d@giganews.com>
<87ttsxjujd.fsf@nosuchdomain.example.com>
<0z-dnUFPU_BLNkP5nZ2dnZeNn_WdnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="ea8927bc2ab431ebe1a4b30f330d88bc";
logging-data="2089786"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JzDcxXYaG4AhUg2GZlDAv"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (windows-nt)
Cancel-Lock: sha1:ilZqlN8++hszzO1ER7vdw9m1fBQ=
sha1:fMjbgxy0yCdKlqNzDfwo62hDSS4=
 by: Pete Forman - Mon, 21 Aug 2023 16:42 UTC

Jakob Bohm <jb-usenet@wisemo.com.invalid> writes:

> On 2023-08-17 22:14, Keith Thompson wrote:
>> Jakob Bohm <jb-usenet@wisemo.com.invalid> writes:
>>> On 2023-08-14 01:47, Keith Thompson wrote:
>>>> ...
>>>> I consider the proposed "8601" in the macro name to be cruft. I don't
>>>> want to add more cruft to my code to avoid it. If it were defined as
>>>> __ISO_8601_DATE__, I'd just use that.
>>>> __DATE__ would be perfect if it weren't already taken.
>>>> The names of the existing __DATE__ and __TIME__ macros don't
>>>> describe
>>>> what format they use (for example, that the month name in __DATE__ is in
>>>> English and the fields are in a US-centric order), because they don't
>>>> need to. A new macro that expands to "2023-08-13" doesn't need to
>>>> either. Users of a hypothetical new standard will read the new
>>>> specification and will know what it means without having to type the
>>>> standard number again every time they use it.
>>>> I like the name __ISODATE__ because ISO 8601 is *the* standard that
>>>> defines date formats. I don't think there would be any confusion about
>>>> which ISO standard is being referenced. (__TIME__ already conforms to
>>>> ISO 8601). I'd accept __YYYMMDD__, but since __DATE__ isn't going away,
>>>> I'd prefer something that suggests that it's closely related to
>>>> __DATE__. Perhaps "__IDATE__".
>>>
>>> Why __YYYMMDD__ (3 Ys, 2 Ms, 2 Ds).
>> Just a typo. I meant __YYYYMMDD__.
>>
>>> Why not simply __YMD__, which I
>>> don't think is taken and is even shorter than __DATE__ .
>> Yes, I mentioned __YMD__ in a previous post.
>>
>>> For additional stability, add a rule in the standard that all 3
>>> date/time macros must refer to the exact same point in time, which must
>>> be within the system time tolerance of preprocessing the program source
>>> code, possibly even during. For example, if the system only tracks
>>> the time in centi-hours (36 seconds each) and preprocessing a
>>> particular C
>>> program takes 0.1s starting at 2023-08-17T23:59:59, the timestamp
>>> used for the macros may be 2023-08-17T23:59:24 or 2023-08-18T00:00:00 .
>>>
>>> That additional rule above has been carefully written to allow all the
>>> following 3 implementations:
>>>
>>> OK1. When starting the preprocessor, detect the current date and time
>>> in a way that doesn't suffer from race conditions, then use that
>>> value throughout.
>>>
>>> OK2. When first expanding either of the 3 macros, capture the
>>> date/time value to be used, thus avoiding the I/O cost of doing so
>>> when the program doesn't use the value.
>>>
>>> OK3. When initiating the preprocessing of the program, the user or
>>> build script specifies an exact date/time to be used by any
>>> available means, such as command line arguments, environment
>>> variables, a control file etc. This implementation is particularly
>>> useful when trying to produce identical programs at different times
>>> and places (so called reproducible builds).
>>>
>>> But it doesn't allow the following bad implementations:
>>>
>>> BAD1. Expand all 3 macros to the timestamp of the source file. This
>>> would be inconsistent with past implementation practice.
>>>
>>> BAD2. Capture the date or time every time either macro is expanded.
>>> This causes a race condition if time crosses midnight during
>>> preprocessing (The example above might end up returning
>>> __YMD__ __TIME__ as "2023-08-17" "00:00:00"
>> Frankly, I don't think all that is necessary.
>> The standard currently says:
>> __DATE__ The date of translation of the preprocessing translation unit:
>> a character string literal of the form "Mmm dd yyyy", where the
>> names of the months are the same as those generated by the
>> asctime function, and the first character of dd is a space
>> character if the value is less than 10. If the date of
>> translation is not available, an implementation-defined valid
>> date shall be supplied.
>> ...
>> __TIME__ The time of translation of the preprocessing translation unit:
>> a character string literal of the form "hh:mm:ss" as in the
>> time generated by the asctime function. If the time of
>>
>
> Neither quote specifies that the values need to be consistent, nor
> that a longer preprocessing time cannot cause an implementation to
> provide values indicating when each occurrence is expanded.
>
>> I think the phrase "translation of the preprocessing translation unit"
>> excludes an implementation that expands to a date or time when the line
>> is reached, which avoids your BAD2 error crossing midnight.
>> Allowing the user to specify a time other than the current one would
>> arguably be non-conforming, though a lot of options are non-conforming.
>> And both gcc and clang already allow -D__DATE__=...
>> I don't think the part about the time being within the system time
>> tolerance is necessary. An implementation would have to go out of its
>> way not to do that anyway.
>>
>
> The reference to system tolerance was intended as a relaxation to dissuade
> implementations from going overboard in trying to get a
> correct time, such as by artificially slowing down the preprocessor
> to the clock advancement rate. Note that my OK3 implementation
> wouldn't be strictly compliant, but could exist in a non-normative
> note to inspire such non-normative behavior needed to ensure
> compliance with security procedures that validate compilation by
> independent recompilation of certified sources.
>
>
>
> Enjoy
>
> Jakob

A disadvantage of __YYYYMMDD__ is that it looks to me, at least, as if
it is ISO 8601 basic format (e.g. 20230821). The proposal being
discussed is using extended format.

As I said in a previous post it would be unwieldy to try to capture all
the detail. It is better to treat it as a name that is not confusing and
can be looked up in the standard to confirm its exact form.

--
Pete Forman
https://payg.pythonanywhere.com/

Re: C23: asctime is obsolescent

<86wmxeur2w.fsf@linuxsc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=578&group=comp.std.c#578

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17687@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.std.c
Subject: Re: C23: asctime is obsolescent
Date: Tue, 29 Aug 2023 02:37:43 -0700
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <86wmxeur2w.fsf@linuxsc.com>
References: <875yf5ksn9.fsf@nosuchdomain.example.com> <861qocrk5b.fsf@linuxsc.com> <IeEsL.27470$cKvc.4521@fx42.iad> <867cx5gpgo.fsf@linuxsc.com> <874js8j18h.fsf@nosuchdomain.example.com> <86h6pyzewi.fsf@linuxsc.com> <87351is0i5.fsf@nosuchdomain.example.com> <865y5i8tqc.fsf@linuxsc.com> <87v8dimrmi.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="1084eb5dd0b1a11121af7ba127734067";
logging-data="2313198"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Nv5Jfr3j5vuhgv9/yLtADHNHh42gEJ9I="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:QEw9JQpWD1HQN5wFgWBa3EBiXU0=
sha1:byKzIDIv0mDbRoiwrzDHMKyfPmg=
 by: Tim Rentsch - Tue, 29 Aug 2023 09:37 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

[...]

I thought I should respond and say I have read through your
comments, and having done so I think I understand your views
and in some cases your reasons for having them. I don't
have anything to add to my earlier comments.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor