9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Pavel Klinkovský" <pavel.klinkovsky@gmail.com>
To: 9fans <9fans@9fans.net>
Subject: Re: [9fans] Strange 'uintptr' behavior
Date: Tue, 25 Jan 2022 08:48:00 +0100	[thread overview]
Message-ID: <CAGNd-2PGJ6UbGkua_RGCkWif2ko+-asAjWciFp89zc5v=Cqk6Q@mail.gmail.com> (raw)
In-Reply-To: <CAJSxfmJfaDUEr6vSpneK5crQvRySMKMO1aurc1XrCC-ckYb75A@mail.gmail.com>

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

Sorry, I was not precise enough.
I prepared arrays in the initiated data segment:


This program cannot be compiled:

#include <u.h>
#include <libc.h>

uintptr frst[] = {nil, nil, nil, nil, nil};
uintptr scnd[] = {nil, nil, frst, &frst[1]};

void main(void) {
exits(nil);
}

...because of:

cpu% 5c t.c
t.c:5 initializer is not a constant: scnd


This program can be compiled:

#include <u.h>
#include <libc.h>

void* frst[] = {nil, nil, nil, nil, nil};
void* scnd[] = {nil, nil, frst, &frst[1]};

void main(void) {
exits(nil);
}

Pavel

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tb5fe0dc43447ab2c-M55c6dc11d2315bac025e3124
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

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

  reply	other threads:[~2022-01-25  7:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 16:50 Pavel Klinkovský
2022-01-24 19:33 ` Alexandr Babic
2022-01-24 19:49   ` Pavel Klinkovský
2022-01-24 19:54     ` Alexandr Babic
2022-01-24 22:26 ` Skip Tavakkolian
2022-01-25  7:48   ` Pavel Klinkovský [this message]
2022-01-25  8:02     ` Re[2]: " Alexandr Babic
2022-01-25  8:26       ` Alex Musolino
2022-01-25  8:33         ` Pavel Klinkovský

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='CAGNd-2PGJ6UbGkua_RGCkWif2ko+-asAjWciFp89zc5v=Cqk6Q@mail.gmail.com' \
    --to=pavel.klinkovsky@gmail.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).