Re: [PATCH v3 5/6] man2/chmod.2: add C digit separators to clarify POSIX feature release dates and long numeric digit strings

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

 



On 2023-02-18 12:03, G. Branden Robinson wrote:
Hi Tom,
At 2023-02-18T18:31:25+0000, Tom Schwindl wrote:
Do you expect C programmers to be more likely to copy and paste from
the man page source document or from the rendered page (probably in
a terminal window, but possibly from a PDF)?

I expect them to copy & paste from the rendered page but I thought
writing out "'" is a bit cumbersome so I refer to it as \[aq].

Ahh, that can be a bit confusing without clear context.  :D

My "worry" with this was that new programmers could potentially
execute a command like the following:
   $ cc -D_POSIX_C_SOURCE=1993'09L test.c
and wonder what they did wrong.

I see--that is a good point.  But I don't know that there is much the
man pages can do about that issue, apart from having a better intro(1)
page.  The scenario you imagine is an unfortunate consequence of the
grouping character WG14 selected.
New C programmers on *nix are going to have to develop some
sophistication with the POSIX shell language as well, and that will be
even more the case now--a cost of letting the Swiss win battles...
Mainly because Alex is reading, I will point out that Ada did this, and
several other aspects of numeric literals, right--40 years ago.

Numeric literals are all introduced by an initial digit. A
requirement that has long been recognized when printing numeric
tables is for a character to break up long sequences of digits: in
Ada, the underline character serves this purpose. In contrast to
identifiers, underlines in numeric literals do not alter the meaning,
so that 12_000 naturally has the same value as 12000.
A simple sequence of digits is an integer literal written in decimal
notation. For other bases from 2 up to 16, the base is given first
and is followed by a sequence of digits enclosed by sharp characters
(#) or by colons (:), the colon being used as replacement character
for the sharp, but only when the sharp is not available. The enclosed
digits may include the letters A to F for bases greater than ten.
Thus, the conventional ways of expressing bit patterns in binary,
octal, or hexadecimal are provided.
Real literals must contain a period, which represents the radix
point. They may be expressed in decimal notation or with other bases.
Finally, both integer and real literals may include the letter E
followed by an exponent.

http://archive.adaic.com/standards/83rat/html/ratl-02-01.html#2.1
But C programmers have long indulged in the sport of ignoring every
lesson any other programming language had to teach, whether through
careful design or blundering mistake.[1]  C'est la vie.

But thinking about it a bit longer, copy & pasting from the rendered
manpage might be the bigger issue.

This prospect was a major factor in my efforts to get groff's own man
pages much more fastidious in this respect, and to promulgate the usage
of appropriate special characters in man page sources, an initiative
that I'm not sure has yet taken flight, although Linux man-pages is
rapidly improving in this regard.  The real test is whether such careful
practice percolates elsewhere, where disinterest in (or outright
resentment of) writing documentation, in man(7), mdoc(7), or any other
form, is rampant.
It is sad that the documentation tools, other than man, were not made freely and widely available, so that the attitudes of many of the original developers towards providing documentation, propagated alongside the system, language, tools, and idioms.

We have the deliberations of IEC/ISO JTC1/SC22/WG21 C++ to thank for the decision a decade ago, as well as the earlier addition of user defined type constants, and other features, imposing restrictions on the preprocessor token parser capabilities, and the strong desires of the WG14 C and WG21 C++ committees to keep as many base features in the languages as possible in sync.
Papers on digit separators:

	https://open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3499.html
	https://open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3661.html
	https://open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf

which C took up only in 2020-2021:

	https://open-std.org/JTC1/SC22/WG14/www/docs/n2606.pdf
	https://open-std.org/JTC1/SC22/WG14/www/docs/n2626.pdf

--
Take care. Thanks, Brian Inglis			Calgary, Alberta, Canada

La perfection est atteinte			Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter	not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer	but when there is no more to cut
			-- Antoine de Saint-Exupéry



[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