Re: 7.5 beta version]
Point 1 I completely agree on: byte order, alignment, padding, etc.
is different for each platform and data cannot directly be exchanged.
Point 2: who really needs C++ ??
-------- Urspr�ngliche Nachricht --------
Betreff: Re: [HACKERS] 7.5 beta version
Datum: Mon, 12 Apr 2004 11:55:45 -0700
Von: "Dann Corbit" <DCorbit@connx.com>
An: "Jeroen T. Vermeulen" <jtv@xs4all.nl>, "Bruce Momjian"
<pgman@candle.pha.pa.us>
CC: <pgsql-hackers@postgresql.org>
-----Original Message-----
From: Jeroen T. Vermeulen [mailto:jtv@xs4all.nl]
Sent: Sunday, April 11, 2004 7:28 AM
To: Bruce Momjian
Cc: Dann Corbit; pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] 7.5 beta versionOn Mon, Apr 05, 2004 at 09:38:13PM -0400, Bruce Momjian wrote:
I don't think you can mix libs/binaries from different compilers.
As long as it's plain old C, and the compilers adhere to the
platform's ABI standards, why not? Even if you compile the C
code using a C++ compiler, as in this case, any C structs
will be PODs and so should be compiled according to the C
layout rules.
1.
The C language does not define alignment of structs.
The C language does not specify that an integer shall be the same size
on two different platforms.
The C language does not specify a portable way even to read and write
structs to disk and preserve alignment across platforms.
The C language does not specify that IEEE arithmetic must be used or
even that a double shall be able to represent a value larger than a
float.
2.
It is a mistake to use a C++ compiler to compile C code, because the
languages are different. Stroustrup's statement that good C code tends
to be valid C++ code is not correct.
Mingw GCC is both a C and a C++ compiler. Fortunately, the C compiler
is used, because there is no way that the code base would compile as C
code. A trivial example to show why not is the frequent use of the C++
keyword 'new' in the code base. Here is an example:
regc_color.c (225): struct colordesc *new;
regc_color.c (251): new = (struct colordesc *) MALLOC(n *
regc_color.c (253): if (new != NULL)
regc_color.c (254): memcpy(VS(new), VS(cm->cdspace), cm->ncds *
regc_color.c (258): new = (struct colordesc *) REALLOC(cm->cd,
regc_color.c (260): if (new == NULL)
regc_color.c (265): cm->cd = new;
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
-----Original Message-----
From: Jürgen Cappel [mailto:email@juergen-cappel.de]
Sent: Monday, April 12, 2004 12:33 PM
To: Dann Corbit
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] 7.5 beta version]Point 1 I completely agree on: byte order, alignment,
padding, etc. is different for each platform and data cannot
directly be exchanged.Point 2: who really needs C++ ??
C++ programmers do. I was responding to a suggestion that PostgreSQL was being compiled as C++. Perhaps I misunderstood.
Show quoted text
-------- Ursprüngliche Nachricht --------
Betreff: Re: [HACKERS] 7.5 beta version
Datum: Mon, 12 Apr 2004 11:55:45 -0700
Von: "Dann Corbit" <DCorbit@connx.com>
An: "Jeroen T. Vermeulen" <jtv@xs4all.nl>, "Bruce Momjian"
<pgman@candle.pha.pa.us>
CC: <pgsql-hackers@postgresql.org>-----Original Message-----
From: Jeroen T. Vermeulen [mailto:jtv@xs4all.nl]
Sent: Sunday, April 11, 2004 7:28 AM
To: Bruce Momjian
Cc: Dann Corbit; pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] 7.5 beta versionOn Mon, Apr 05, 2004 at 09:38:13PM -0400, Bruce Momjian wrote:
I don't think you can mix libs/binaries from different compilers.
As long as it's plain old C, and the compilers adhere to the
platform's ABI standards, why not? Even if you compile the C code
using a C++ compiler, as in this case, any C structs willbe PODs and
so should be compiled according to the C layout rules.
1.
The C language does not define alignment of structs.The C language does not specify that an integer shall be the
same size on two different platforms.The C language does not specify a portable way even to read
and write structs to disk and preserve alignment across platforms.The C language does not specify that IEEE arithmetic must be
used or even that a double shall be able to represent a value
larger than a float.2.
It is a mistake to use a C++ compiler to compile C code,
because the languages are different. Stroustrup's statement
that good C code tends to be valid C++ code is not correct.Mingw GCC is both a C and a C++ compiler. Fortunately, the C
compiler is used, because there is no way that the code base
would compile as C code. A trivial example to show why not
is the frequent use of the C++ keyword 'new' in the code
base. Here is an example: regc_color.c (225): struct
colordesc *new; regc_color.c (251): new = (struct colordesc
*) MALLOC(n * regc_color.c (253): if (new != NULL)
regc_color.c (254): memcpy(VS(new), VS(cm->cdspace),
cm->ncds * regc_color.c (258): new = (struct colordesc *)
REALLOC(cm->cd, regc_color.c (260): if (new == NULL)
regc_color.c (265): cm->cd = new;---------------------------(end of
broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
Import Notes
Resolved by subject fallback
J�rgen Cappel wrote:
Point 1 I completely agree on: byte order, alignment, padding, etc.
is different for each platform and data cannot directly be exchanged.Point 2: who really needs C++ ??
We use it, a multi path TCP router written in C++ and behind
there is a Postgresql...
Regards
Gaetano Mendola