all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: dalanicolai <dalanicolai@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: What is the recommended way to find out the number of arguments passed to a module function?
Date: Wed, 10 Jan 2024 21:43:36 +0100	[thread overview]
Message-ID: <CACJP=3nEhDH74ja=qi8ukhOOZrXs09jpGXTuTj6n=HEoedYj8w@mail.gmail.com> (raw)
In-Reply-To: <CACJP=3kmqyDhDugWiJwccBL37cg+yK_vdg3XHby0RbXiJA5bJg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1469 bytes --]

Well, english is not my first language. Of course, I hope not to get used
to them :))

On Wed, 10 Jan 2024 at 21:41, dalanicolai <dalanicolai@gmail.com> wrote:

> Thanks Eli.
>
> Also, I realize now, that sizeof works differently on an array and a
> pointer (to an array) (AFAIU).
> I guess I will slowly or quickly get used to these (initial) pitfalls.
>
>
> On Wed, 10 Jan 2024 at 21:10, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > From: dalanicolai <dalanicolai@gmail.com>
>> > Date: Wed, 10 Jan 2024 21:05:22 +0100
>> >
>> > Ah okay, well I am completely new to C, so I am still finding out
>> things (e.g. I have not 'actively' used
>> > ptrdiff yet).
>> > But indeed the 'nargs' just give the number of passed args (obviously).
>> >
>> > I had checked the 'sizeof' the args array when passing an argument and
>> without passing an
>> > argument,
>> > and it was the same. Then the docs mention that NARGS is the 'required'
>> number of arguments,
>> > I had misunderstood it a little (of course the required number is
>> variable, but somehow I assumed it
>> > would be 1 in this case). So sometimes I overlook the 'obvious', and
>> because I had spent some time
>> > on testing
>> > things already, I decided to just ask here.
>>
>> The args[] array gets allocated exactly to accommodate nargs
>> arguments, so you should never access args[] beyond the index nargs-1.
>>
>> > Anyway, as usual, thanks for your quick and helpful answer!
>>
>> You're welcome.
>>
>

[-- Attachment #2: Type: text/html, Size: 2272 bytes --]

  reply	other threads:[~2024-01-10 20:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 19:01 What is the recommended way to find out the number of arguments passed to a module function? dalanicolai
2024-01-10 19:15 ` Eli Zaretskii
2024-01-10 20:06   ` dalanicolai
     [not found]   ` <CACJP=3mw8tcNXWeH3=Ge5OuDBQ=Jwc9+yYxFejg5weBPXYU4bQ@mail.gmail.com>
2024-01-10 20:10     ` Eli Zaretskii
2024-01-10 20:41       ` dalanicolai
2024-01-10 20:43         ` dalanicolai [this message]
2024-01-11  6:02           ` Eli Zaretskii
2024-01-12  0:52 ` Emanuel Berg

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='CACJP=3nEhDH74ja=qi8ukhOOZrXs09jpGXTuTj6n=HEoedYj8w@mail.gmail.com' \
    --to=dalanicolai@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.