delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/07/13:35:34

From: broeker AT acp3bf DOT knirsch DOT de (Hans-Bernhard Broeker)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: far pointers again
Date: 7 Oct 1999 15:35:07 +0200
Organization: RWTH Aachen, III. physikalisches Institut B
Lines: 53
Message-ID: <7ti7ib$3hn@acp3bf.knirsch.de>
References: <E1FF8239A075D311AF7200A0C9D60AE30804E3 AT probe-2 DOT acclaim-euro DOT net> <7tf476$8qj AT cs DOT vu DOT nl> <7tff80$2kp AT acp3bf DOT knirsch DOT de> <7thn9e$cil AT cs DOT vu DOT nl>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 939303310 15080 137.226.32.75 (7 Oct 1999 13:35:10 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 7 Oct 1999 13:35:10 GMT
X-Newsreader: TIN [version 1.2 PL2]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

FokkemaDBRA wrote:
> Hans-Bernhard Broeker (broeker AT acp3bf DOT knirsch DOT de) wrote:
> : As soon as you add the 'far' keyword, one of the most fundamental
> : assumptions in C breaks down: a pointer is a pointer is a pointer.
> What exactly do you mean by that? Does this also go for a pointer to a char?
> Why does 'far' breaks this concept down?

Because there are now to incompatible types of 'pointer to char':

	char far * a_far_pointer;
	char * a_near_pointer;

There are situations where you can use both, and situations where only
one type of pointer works. The C language is not prepared for such
nuisance. To give an example, every 'void *' would have to be a 'void
far *', behind the scenes, because otherwise the Standard's rule would
break that every pointer, if casted to 'void *', and later casted back
to its original type, must come out identical to what it started to.

So either far pointers aren't pointers, in the meaning of the C
Standard, or there cannot be near pointers to void, which will cause
performance losses for functions like malloc() and friends.

'far' is one big mess, and best avoided, wherever possible. At least
as long as you're willing to write *C* programs. 'C with far pointers'
is a completely different language, in the same sense that C++ is a
different language, even though many beginners have been fooled into
believing that a language called 'C/C++' exists. It doesn't.

Many C programmers who have grown up using MS-DOS C compilers, and/or
one of the many extremely badly written C textbooks surrounding them,
have been mislead to assume that 'far' (like the bad old 'void main')
is a native inhabitant of C land, and has a right to be there. It
isn't, and it hasn't.

> : "Many millions of flies eat sh*t. So we should eat it, as well." or
> : what? This argument has never been a good one.
> It was not an argument. Just a statement. With all due respect, that
> it is sh*t is just your opinion. Maybe that of countless others too,
> but it is still an opinion.

Your statement was of the kind 'many others have done it, so it must
be a good idea'. That's exactly the 'millions of flies' argument.
It's largely irrelevant if the subject matter is sh*t or not -- the
whole argument is nonsensical, either way.

--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019