9front - general discussion about 9front
 help / color / mirror / Atom feed
From: jamos@oboj.net
To: 9front@9front.org
Cc: Trevor Higgins <plan9fullfrontal@qs.co.nz>
Subject: Re: [9front] APE stddef.h ptrdiff_t should it be 8?
Date: Sun, 08 Mar 2020 16:50:23 +0100	[thread overview]
Message-ID: <66fdbcee9b4c64c3289c20e5a9379693@oboj.net> (raw)
In-Reply-To: <8b63d3cf-0fda-1e69-a40f-32322b400548@qs.co.nz>

Others on this list of course know these things
much better than me, but this is my understanding:

The header file, as it is different for different
architectures should be in /$objtype/inlcude/ape _instead_
of in the current location. You'd have to have one
header file each objtype to, but it would probably only
be the definition of ptrdiff_t that would differ,
depending on 32 or 64 bit addresses for the arch.
In Plan 9, include files does in general not include other
include files either.

And it should be 'long long' in ape, as vlong isn't defined.

/Jonas

On 2020-03-08 00:14, Trevor Higgins wrote:

> On 03/08/2020 04:55 AM, ori@eigenstate.org wrote: I ran into a 
> fustercluck trying to get tcl to run on amd64.
  just random memory corruptions as would be expected.

>> Can you be more specific? What failed?
>> 
>> Turns out it is due to APE ptrdiff_t being defined as long and not 
>> long
>> long (which it is on *nix).
>> 
>> What is the correct definition of ptrdiff_t on amd64?
> The definition should be a vlong, since that's what subtracting
> two pointers yields. If you want to submit a patch, the system
> dependent location for this is:
> 
> /$objtype/include/ape/stdint.h
  Not wishing to be picky, but vlong would not be APE , correct or not? 
it would be typedef long long.
Also this change still requires patching /sys/include/ape/stddef.h to 
prevent attempt to duplicately define the structure
and Probably for good measure in both files:
#ifndef _PTRDIFF_T
#define _PTRDIFF_T
typedef  <arch specific>  ptrdiff_t   /*** long long in amd64 and just 
long in sys/include/ape/stddef.h **/
#endif

Or maybe , ptrdiff_t should be removed from stddef.h


  reply	other threads:[~2020-03-08 15:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-07  9:44 Trevor Higgins
2020-03-07 15:55 ` [9front] " ori
2020-03-07 23:14   ` Trevor Higgins
2020-03-08 15:50     ` jamos [this message]
2020-03-09  4:06       ` ori
2020-03-09  9:39         ` [9front] APE stddef.h ptrdiff_t should it be 8? [Tcl memory problem] Trevor Higgins
2020-03-09 15:24           ` ori

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=66fdbcee9b4c64c3289c20e5a9379693@oboj.net \
    --to=jamos@oboj.net \
    --cc=9front@9front.org \
    --cc=plan9fullfrontal@qs.co.nz \
    /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).