Mark H Weaver <[email protected]> skribis:
> I've come to the conclusion that it is not safe to modify 'scm_t_port'
> in 2.0 at all; not even to change the member names. In brief, the
> reason has to do with the C11 standard definition of "compatible types",
> which ties into the strict aliasing rules. Section 6.2.7 of C11 spells
> out what it means for two structures declared in separate translation
> units to be compatible, and among other things their member names must
> be the same.
I can’t imagine how changing the *name* of a member could change
something to the structure’s layout in practice.
I would be in favor of keeping the names ‘internal’ and ‘reserved’ from
your previous patch, but if you’re really convinced that this member
name thing has a practical effect, fine with me.
> Is this a reasonable start? Any suggestions before I proceed?
Looks good to me!
> +#define scm_gc_typed_calloc(t) ((t *) scm_gc_calloc (sizeof (t), #t))
Not really convinced by this, but hey. Ideally, this would need to go
in the manual too.
> +typedef struct scm_t_port_internal
> +{
> + /* input/output iconv conversion descriptors */
> + void *input_cd;
> + void *output_cd;
> +} scm_t_port_internal;
Please define the struct tag and typedef separately. Also, I’d remove
‘_t’ from the struct tag, as discussed before.
Thanks for your patience & thoroughness! :-)
Ludo’.