guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add internal-only port structure; move iconv descriptors the


From: Andy Wingo
Subject: Re: [PATCH] Add internal-only port structure; move iconv descriptors there
Date: Mon, 01 Apr 2013 22:54:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

On Mon 01 Apr 2013 22:03, Mark H Weaver <address@hidden> writes:

>>>    SCM z = scm_cons (SCM_EOL, SCM_EOL);
>>> -  scm_t_port *entry = (scm_t_port *) scm_gc_calloc (sizeof (scm_t_port), 
>>> "port");
>>> +  scm_t_port *entry = scm_gc_typed_calloc (scm_t_port);
>>> +  scm_t_port_internal *pti = scm_gc_typed_calloc (scm_t_port_internal);
>>>    const char *enc;
>>
>> How about allocating a struct { scm_t_port a; scm_t_port_internal b; }
>> and get the pointers from there?
>
> I was hoping to do something like this in master, but having thought
> about it some more, I don't see how to do this without running afoul of
> the strict aliasing rules.

Though we already violate them in innumerable ways in Guile, this is not
one of those cases:

  struct foo { a a; b b; } *foo;
  foo = malloc (sizeof (*foo));
  a* a = &bar.a;
  b* b = &bar.b;

Andy
-- 
http://wingolog.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]