public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	libc-alpha@sourceware.org
Subject: Re: [PATCH 3/3] posix: New Linux posix_spawn{p} implementation
Date: Sun, 28 Feb 2016 16:41:00 -0000	[thread overview]
Message-ID: <56D26862.9090702@cs.ucla.edu> (raw)
In-Reply-To: <56D0D129.2070201@linaro.org>

Adhemerval Zanella wrote:
> I see using const on complex expression might help compiler
> get logic errors (where the variable is set to a different value)

In that case, you should also put "register" in your local declarations too, 
right?  Something like this:

    register const int prot = PROT_READ | PROT_WRITE;

That way, you are also guarded against errors where later code mistakenly 
attempts to take the address of 'prot'.

You may think I'm joking, but I have worked with programmers who believe in this 
sort of thing, and I have experience with (non-GNU) code using this style. The 
problem with this approach is that the attributes get in the way of reading the 
code. Attributes like 'const' can make sense for globals, but for local 
variables the hassle of maintaining them typically outweighs the meager benefits 
of having them. That's certainly the case for this example, anyway.

  reply	other threads:[~2016-02-28  3:31 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 13:57 [PATCH 0/3] posix: Execute file function fixes Adhemerval Zanella
2016-02-26 13:57 ` [PATCH 3/3] posix: New Linux posix_spawn{p} implementation Adhemerval Zanella
2016-02-26 17:33   ` Joseph Myers
2016-02-26 20:07     ` Adhemerval Zanella
2016-02-26 20:49   ` Paul Eggert
2016-02-26 23:47     ` Adhemerval Zanella
2016-02-28 16:41       ` Paul Eggert [this message]
2016-02-29 18:33         ` Adhemerval Zanella
2016-02-26 13:57 ` [PATCH 2/3] posix: execvpe cleanup Adhemerval Zanella
2016-02-26 19:40   ` Paul Eggert
2016-02-26 22:22     ` Adhemerval Zanella
2016-02-27 23:18       ` Adhemerval Zanella
2016-02-28  3:31         ` Paul Eggert
2016-02-29 17:45           ` Adhemerval Zanella
2016-02-26 14:19 ` [PATCH 1/3] posix: Remove dynamic memory allocation from execl{e,p} Adhemerval Zanella
2016-02-26 19:11   ` Paul Eggert
2016-02-26 19:44     ` Adhemerval Zanella
2016-02-26 20:13       ` Paul Eggert
2016-02-26 20:18         ` Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2016-02-29 18:33 [PATCH v5 0/3] posix: Execute file function fixes Adhemerval Zanella
2016-02-29 19:08 ` [PATCH 3/3] posix: New Linux posix_spawn{p} implementation Adhemerval Zanella
2016-04-12 18:06   ` Szabolcs Nagy
2016-04-12 18:15     ` Adhemerval Zanella
2016-04-12 20:21       ` Adhemerval Zanella
2016-04-12 20:35         ` Adhemerval Zanella
2016-05-29 17:38   ` Eric Wong
2016-05-30 11:35     ` Florian Weimer
2016-05-30 13:07       ` Adhemerval Zanella
2016-05-30 21:07         ` Eric Wong
2016-05-31 13:08           ` Adhemerval Zanella
2016-02-22 13:03 [PATCH v3 0/3] posix: Execute file function fixes Adhemerval Zanella
2016-02-22 13:03 ` [PATCH 3/3] posix: New Linux posix_spawn{p} implementation Adhemerval Zanella
2016-02-19 18:05 [PATCH v2 0/3] posix: Execute file function fixes Adhemerval Zanella
2016-02-19 18:06 ` [PATCH 3/3] posix: New Linux posix_spawn{p} implementation Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D26862.9090702@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).