groff
[Top][All Lists]
Advanced

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

Re: [groff] hyphenation issues


From: G. Branden Robinson
Subject: Re: [groff] hyphenation issues
Date: Sat, 5 May 2018 07:40:05 -0400
User-agent: NeoMutt/20170113 (1.7.2)

At 2018-05-05T11:51:00+0100, Keith Marshall wrote:
> On 05/05/18 10:48, G. Branden Robinson wrote:
> > (Incidentally, I share your preference for putting type qualifiers
> > [as opposed to storage classes] _after_ the type name itself.  It
> > makes complex declarations easier to understand.)
> 
> Personally, I consider that to be a poor choice ... especially if you
> are making it on purely stylistic grounds; conventionally:
> 
>   const int foo;
> 
> is more common than:
> 
>   int const foo;

Yes, it's more common.  And ill-advised.

> but that's not the real issue.  In practice, the placement of "const"
> qualifiers is *not* arbitrary;

That's true.  It largely follows from the English practice of placing
adjectives before nouns.  That's good comment style but risky C style.

> far from "making the declaration easier to understand", it can effect
> a subtle change in meaning.

Indeed.

> For example,
> in C code, it is very common to see:
> 
>   const char *foo;
> 
> which means something very different from:
> 
>   char const *foo;

Actually, it doesn't.  Try it.

> Your stylistic preference might encourage the latter idiom, but it
> likely isn't what you meant.  (The former declares a mutable pointer to
> an immutable C-string; the latter is an immutable pointer to a mutable
> C-string).

Experiment with the attached program.

-- 
Regards,
Branden

Attachment: const.c
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]