9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] varargs question
Date: Thu, 20 Aug 2009 08:05:46 -0700	[thread overview]
Message-ID: <dd6fe68a0908200805q677254a5q4541b71f0b89745a@mail.gmail.com> (raw)
In-Reply-To: <fd20b857fbfca820d769296f8f844428@quanstro.net>

On Thu, Aug 20, 2009 at 6:56 AM, erik quanstrom<quanstro@quanstro.net> wrote:
> and i wondered why kenc doesn't add an argument
> count before the first vararg.  (bwc pointed out
> that the address following the last vararg would be
> more useful.)  va_* could be updated to deal with
> the silent extra and abort on access beyond the end
> of the actual variable arguments.  a function to check
> that list == end could added for the paranoid.

what problem are you trying to solve?

the limit would check only that the right number of
argument bytes are consumed, but not that they are
interpreted correctly.  print("%s %d", 1, "hello") would
still crash, as would print("%s", 1, "hello").

#pragma varargck is more precise and can be
done at compile time instead of needing to wait
until the code trips at run time.

russ


  reply	other threads:[~2009-08-20 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-20 13:56 erik quanstrom
2009-08-20 15:05 ` Russ Cox [this message]
2009-08-20 15:32   ` erik quanstrom

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=dd6fe68a0908200805q677254a5q4541b71f0b89745a@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@9fans.net \
    /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 NNTP newsgroup(s).