Fwd: New GCC compiler for 8086 cpu's

David Given <[email protected]> Wed, 21 Jun 2017 00:46:14 +0200
Newsgroups org.kernel.vger.linux-8086
Message-ID <CALgV52j3dC_hiUbAkJW3AuUFWHbvqbsyKGxZ3sJAeb20o1Vm7Q@mail.gmail.com>
Unfortunately C doesn't distinguish between pointers to objects in the
heap and pointers to objects on the stack. Consider this:

{
  int buffer[256];
  int* pointer =3D buffer; // pointer points to stack frame
  pointer =3D malloc(256*sizeof(int)); // now it points to heap
  return buffer[0]; // so the same instruction here needs to be able
to cope with either
}

Vanilla C has two address spaces --- code and data. You're not allowed
to (portably) turn one to the other, so they can live in different
segments. But the stack and the heap are defined to be in the same
address space, and pointers to them have to be interchangeable. So
they need to live in the same segment.

--=20
=E2=94=8C=E2=94=80=E2=94=80=E2=94=80 http://www.cowlark.com =E2=94=80=E2=94=
=80=E2=94=80
=E2=94=82 "I have always wished for my computer to be as easy to use as my
=E2=94=82 telephone; my wish has come true because I can no longer figure o=
ut
=E2=94=82 how to use my telephone." --- Bjarne Stroustrup