Re: Revert "Many Pages: Remove references to C89"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Oskari,

On 3/14/23 06:39, Oskari Pirhonen wrote:
> Hi,
> 
> On Mon, Mar 13, 2023 at 13:00:52 +0100, Alejandro Colomar wrote:
> 
> ... snip ...
> 
>>>> <https://port70.net/~nsz/c/c89/c89-draft.txt>
>>>>
>>>> I suggest you download that file, and use a function like this:
>>>>
>>>> $ stdc89() { grep "[[:alpha:]] \**\b$1([[:alnum:]*,. ]*);" /path/to/c89-draft.txt; }
>>>> $ stdc89 printf
>>>>          int printf(const char *format, ...);
>>>>          int printf(const char *format, ...);
>>>>
>>>
>>> I gave this a quick spin and it seems to work decently well. So thanks
>>> for that.
>>
>> :-)
>>
>>> It's still not quite as nice as having C89 mentioned in
>>> STANDARDS, and couldn't this be leveraged to fix up the inconsistencies
>>> you mentioned earlier?
>>
>> Yup, you caught me.  That's what I thought when writing the email.  :p
>>
> 
> I played around with this a bit more, and with a little work it should
> be possible to query, eg, all the "str*" functions. As it's written,
> it's doable with something like this (but not the most elegant):
> 
>     $ stdc89 'str[[:alnum:]]*'
>     double strtod(const char *nptr, char **endptr);
>     long int strtol(const char *nptr, char **endptr, int base);
>     char *strcpy(char *s1, const char *s2);
>     char *strcat(char *s1, const char *s2);
>     int strcmp(const char *s1, const char *s2);
>     ...
> 
> The duplicates and leading whitespace is a trivial change.

stdc89()
{
    grep "[[:alpha:]] \**\b$1([[:alnum:]*,. ]*);" /path/to/c89-draft.txt \
    | sort \
    | uniq;
}

That seems to be enough.  I don't know if in some cases there will be
whitespace difference that will make this not work, but I tried with
'printf' and 'gets' and it seems to work so far.

> 
> Looking at the site you linked to for the c89-draft.txt, there's also
> C99, C11, and C2x. With yet some more work, it'd be possible to have
> equivalent functions for those standards as well. They could even be
> combined to create an "std-diff" tool to give, eg, new "str*" functions
> introduced in C89 -> C99.
> 
> Perhaps such a tool already exists, but I thought it worth mentioning
> here in case anyone reading this gets inspired to write it. I've added
> it to my (ever growing) TODO list, but don't know when I might get
> around to actually giving it a go.

Interesting idea.  Sounds fun to do.  I'll check if we can redistribute
the drafts of the standard in the Linux man-pages repo.  If so, we could
have the standard .txt files in some directory inside the repo, and then
have a script that reads those files.

> 
> ... snip ...
> 
>>> "Usefulness" seems to be a hard sell for you, but perhaps you would
>>> reconsider it based on the historical relevance of C89? It was, after
>>> all, the first proper standard of the C language. If you don't want to
>>> promote C89 by having it mentioned alongside the others, perhaps you'd
>>> be open to the idea of adding a historical note?
>>
>> I've been considering something like that for a long time.  The
>> STANDARDS section (previously known as CONFORMING TO), is a mix of a
>> proper standards section, and what a HISTORY section should contain.
>>
>> It would be interesting to do a split, and inaugurate a HISTORY section.
>> For that section, I would keep any references to C89, since as you say
>> it's historically very relevant.  Thus, I will revert the patch, and later apply some patches that move the info without discarding it.
>>
> 
> Well this is good news, and if you ask me, an improvement in the long
> run instead of just returning to the status quo.

Nice :)

> 
> Much appreciated :)

You're welcome :-)

> 
> - Oskari

Cheers,

Alex

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux