#12515: can't build Haiku within haiku.
-------------------------+----------------------------
Reporter: khallebal | Owner: nobody
Type: bug | Status: closed
Priority: normal | Milestone: Unscheduled
Component: - General | Version: R1/Development
Resolution: fixed | Keywords:
Blocked By: | Blocking: 13103
Has a Patch: 1 | Platform: x86
-------------------------+----------------------------
Comment (by pulkomandy):
Yes, the pattern that would fails is more complex. Copying the struct
itself is fine. The problem is if your struct is such made:
{{{
struct s2 {
int i;
};
struct s {
struct s2* realContext;
};
}}}
Now let's imaging a function that does some processing:
{{{
void doStuff(struct s* context)
{
context->realContext->i++;
}
}}}
If you try to save the context:
{{{
struct s context;
struct s tmp = context; // backup copy, so we can restore if things go
wrong
doStuff(context);
// Something went wrong! Restore the context!
context = tmp;
}}}
Here, the value of "i" will not be restored.
--
Ticket URL: <https://dev.haiku-os.org/ticket/12515#comment:30>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.