G
Gene
Hello all. I do not have access to the ANSI standard doc. Perhaps
someone can help me with this. Suppose I have this situation:
typedef void *PTR;
struct cons_s {
PTR car, cdr;
};
struct root_record_s {
...
struct cons_s *p;
};
PTR cons(struct root_record_s *rr, PTR car, PTR cdr)
{
...
rr->p->cdr = gc_malloc(rr, sizeof(struct cons_s));
...
}
where gc_malloc may change the value of rr->p. Is there anything in
the ANSI standard that says rr->p->cdr will be the "correct" l-value,
e.g. the new one after gc_malloc() makes the change? Or must the
assignmet be split into two to ensure correct sequencing? ...
PTR cons(struct root_record_s *rr, PTR car, PTR cdr)
{
PTR tmp;
...
tmp = gc_malloc(rr, sizeof(struct cons_s));
rr->p->cdr = tmp;
...
}
Many thanks.
someone can help me with this. Suppose I have this situation:
typedef void *PTR;
struct cons_s {
PTR car, cdr;
};
struct root_record_s {
...
struct cons_s *p;
};
PTR cons(struct root_record_s *rr, PTR car, PTR cdr)
{
...
rr->p->cdr = gc_malloc(rr, sizeof(struct cons_s));
...
}
where gc_malloc may change the value of rr->p. Is there anything in
the ANSI standard that says rr->p->cdr will be the "correct" l-value,
e.g. the new one after gc_malloc() makes the change? Or must the
assignmet be split into two to ensure correct sequencing? ...
PTR cons(struct root_record_s *rr, PTR car, PTR cdr)
{
PTR tmp;
...
tmp = gc_malloc(rr, sizeof(struct cons_s));
rr->p->cdr = tmp;
...
}
Many thanks.