POV-Ray : Newsgroups : povray.off-topic : C/C++ Data Type Ambiguity Backwards : Re: Platform with non-8-bit bytes Server Time
8 Jul 2024 08:41:56 EDT (-0400)
  Re: Platform with non-8-bit bytes  
From: Lars Rohwedder
Date: 28 Aug 2015 09:37:45
Message: <55e06429@news.povray.org>
> I saw an FAQ page somewhere that had examples of systems where the size
> of a pointer really does change depending on what it points to.
> 
> I imagine trying to do C on a Harvard architecture machine would be
> "interesting" for exactly this reason. (And I gather that's quite
> popular in DSP chips...)

You don't need an exotic DSP platform, just use C or C++ on DOS. There
you have different "memory models" (TINY, SMALL, MEDIUM, COMPACT, LARGE,
HUGE), which result in different pointer sizes for code and/or data and
the way pointer arithmetics work at all.

In the SMALL model object and function pointers are incomparable. They
both are 16 bit but point to completely independent 64K memory segments.
In the MEDIUM and COMPACT models the size of object pointers and
function pointers differ (one is 16 the other is 32 bit, in the other
model the sizes are reverted)

I'd like to see that every C programmer has to learn C on such a
platform so they never ever learn to du non-ISO-C-compliant pointer
conversions. But I think it is too late for that. ;-(

Lars R.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.