473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Struct in C and C++

Struct in C and C++ are same? Can Struct in C handle member functions?

Jun 12 '06 #1
29 1865
>>>> Struct in C and C++ are same? Can Struct in C handle member functions?

No
Jun 12 '06 #2

vi********************@gmail.com wrote:
Struct in C and C++ are same?

NO

Can Struct in C handle member functions?

NO

Jun 12 '06 #3

Jaspreet wrote:
vi********************@gmail.com wrote:
Struct in C and C++ are same?

NO

Can Struct in C handle member functions?

NO


struct X
{

void (*f)();
};

....

void ConstructX(struct X * x)
{
x = &someFun;
}

It's just a lot more hand work.

Jun 12 '06 #4
"Noah Roberts" writes:
> Struct in C and C++ are same?

NO

Can Struct in C handle member functions?

NO


struct X
{

void (*f)();
};

...

void ConstructX(struct X * x)
{
x = &someFun;
}

It's just a lot more hand work.


And it ignores the fact that the phrase "member function" has a particular,
definite meaning in the C++ language.
Jun 12 '06 #5

osmium wrote:
And it ignores the fact that the phrase "member function" has a particular,
definite meaning in the C++ language.


That's a pretty silly statement.

If you want to compare features of two different languages then use the
most generic terms available.

Jun 12 '06 #6
More like:

Noah Roberts wrote:
Jaspreet wrote:
vi********************@gmail.com wrote:

struct X
{

void (*f)(X * this__); // <--------- this pointer :)
};

...

void ConstructX(struct X * x)
{
x = &someFun;
}


Jun 12 '06 #7

u.********@gmail.com wrote:
More like:

Noah Roberts wrote:
Jaspreet wrote:
vi********************@gmail.com wrote:

struct X
{

void (*f)(X * this__); // <--------- this pointer :)
};


Yeah, I neglected that param. Long time since I used C for OO :p

Jun 12 '06 #8

"Noah Roberts" <ro**********@gmail.com> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.com...

osmium wrote:
And it ignores the fact that the phrase "member function" has a
particular,
definite meaning in the C++ language.


That's a pretty silly statement.

If you want to compare features of two different languages then use the
most generic terms available.


Your construction is certainly not a member function. For instance it
doesn't have a hidden "this" pointer. The only correct statement is that C
doesn't handle member functions, period.

Cy

Jun 12 '06 #9

Noah Roberts wrote:
u.********@gmail.com wrote:
Yeah, I neglected that param. Long time since I used C for OO :p


Isn't it true that C++ compilers were first written in C originally?
Kind of like that paradymn where a tool making machine produces machine
parts that are more precise than any individual component making up the
tool making machine.

RL

Jun 12 '06 #10

"raylopez99" <ra********@yahoo.com> schrieb im Newsbeitrag
news:11**********************@f6g2000cwb.googlegro ups.com...

Noah Roberts wrote:
u.********@gmail.com wrote:


Yeah, I neglected that param. Long time since I used C for OO :p


Isn't it true that C++ compilers were first written in C originally?
Kind of like that paradymn where a tool making machine produces
machine
parts that are more precise than any individual component making up
the
tool making machine.

uhm... and the first C compiler was written in ASM originally, so...
Jun 13 '06 #11
In article <4f*************@individual.net>,
Me@Privacy.net says...

[ ... ]
uhm... and the first C compiler was written in ASM originally, so...


Are you sure of that? I'd have guessed it would have been
written in NB.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jun 13 '06 #12

Gernot Frisch wrote:
"raylopez99" <ra********@yahoo.com> schrieb im Newsbeitrag
news:11**********************@f6g2000cwb.googlegro ups.com...

Noah Roberts wrote:
u.********@gmail.com wrote:


Yeah, I neglected that param. Long time since I used C for OO :p


Isn't it true that C++ compilers were first written in C originally?
Kind of like that paradymn where a tool making machine produces
machine
parts that are more precise than any individual component making up
the
tool making machine.

uhm... and the first C compiler was written in ASM originally, so...


Actually the first C++ compiler was itself written in C++ - which might
sound like a chicken-and-egg impossibility were it not for one fact:
the first C++ compiler (CFront) did not actually compile C++ source
code (including its own) directly - rather it first translated C++
source code into C and then compiled the translated sources with a C
compiler. Pretty simple, isn't it?

Greg

Jun 13 '06 #13
Greg wrote:
[...]
Actually the first C++ compiler was itself written in C++ - which
might sound like a chicken-and-egg impossibility were it not for one
fact: the first C++ compiler (CFront) did not actually compile C++
source code (including its own) directly - rather it first translated
C++ source code into C and then compiled the translated sources with
a C compiler. Pretty simple, isn't it?


I think you're confused. "Compile C++" and "translate C++" are pretty
much the same thing. So, how could it have been written in C++? What
would be used to translate its own code from C++ "into C"? And if it
wasn't used itself, what was used? And if, in fact, some other thing
was used, what do you call it if not "C++ translator"? And what was
that thing written in? Catch my drift? There is no "chicken and egg"
problem. The "chicken and egg" conundrum exists when there is circular
dependency. There is none here. First C++ compiler/translator was
most likely written in C (or C With Classes or some other predecessor
of the "real C++"). After than each next version of a C++ compiler is
written in C++ probably (because the C++ compiler programmers know C++
the best), and any new advanced features the next version implements
are simply not used to write it (because the compiler does not support
them). That's just evolution of tools. For example, what debugger is
used to debug a debugger?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 13 '06 #14

Victor Bazarov wrote:
Greg wrote:
[...]
Actually the first C++ compiler was itself written in C++ - which
might sound like a chicken-and-egg impossibility were it not for one
fact: the first C++ compiler (CFront) did not actually compile C++
source code (including its own) directly - rather it first translated
C++ source code into C and then compiled the translated sources with
a C compiler. Pretty simple, isn't it?


I think you're confused. "Compile C++" and "translate C++" are pretty
much the same thing. So, how could it have been written in C++?


Something like C compilers maybe. Start with a machine code assembler.
Assemble stage1 compiler. Compile stage 2....etc...until you
eventually compile your actual compiler.

Jun 13 '06 #15

Victor Bazarov wrote:
Greg wrote:
[...]
Actually the first C++ compiler was itself written in C++ - which
might sound like a chicken-and-egg impossibility were it not for one
fact: the first C++ compiler (CFront) did not actually compile C++
source code (including its own) directly - rather it first translated
C++ source code into C and then compiled the translated sources with
a C compiler. Pretty simple, isn't it?


I think you're confused. "Compile C++" and "translate C++" are pretty
much the same thing. So, how could it have been written in C++? What
would be used to translate its own code from C++ "into C"? And if it
wasn't used itself, what was used? And if, in fact, some other thing
was used, what do you call it if not "C++ translator"? And what was
that thing written in? Catch my drift? There is no "chicken and egg"
problem. The "chicken and egg" conundrum exists when there is circular
dependency. There is none here. First C++ compiler/translator was
most likely written in C (or C With Classes or some other predecessor
of the "real C++"). After than each next version of a C++ compiler is
written in C++ probably (because the C++ compiler programmers know C++
the best), and any new advanced features the next version implements
are simply not used to write it (because the compiler does not support
them). That's just evolution of tools. For example, what debugger is
used to debug a debugger?


The first C++ compiler was written in C++. It compiled itself. From
Wikipedia:

"As Cfront was written in C++, it was a challenge to bootstrap on a
machine without a C++ compiler/translator. Along with the Cfront C++
sources, a special "half-preprocessed" version of the C code resulting
from compiling Cfront with itself was also provided. This C code was to
be compiled with the native C compiler, and the resulting executable
could then be used to compile the Cfront C++ sources."

Greg

Jun 15 '06 #16

Greg wrote:
Victor Bazarov wrote:
Greg wrote:
[...]
Actually the first C++ compiler was itself written in C++ - which
might sound like a chicken-and-egg impossibility were it not for one
fact: the first C++ compiler (CFront) did not actually compile C++
source code (including its own) directly - rather it first translated
C++ source code into C and then compiled the translated sources with
a C compiler. Pretty simple, isn't it?


I think you're confused. "Compile C++" and "translate C++" are pretty
much the same thing. So, how could it have been written in C++? What
would be used to translate its own code from C++ "into C"? And if it
wasn't used itself, what was used? And if, in fact, some other thing
was used, what do you call it if not "C++ translator"? And what was
that thing written in? Catch my drift? There is no "chicken and egg"
problem. The "chicken and egg" conundrum exists when there is circular
dependency. There is none here. First C++ compiler/translator was
most likely written in C (or C With Classes or some other predecessor
of the "real C++"). After than each next version of a C++ compiler is
written in C++ probably (because the C++ compiler programmers know C++
the best), and any new advanced features the next version implements
are simply not used to write it (because the compiler does not support
them). That's just evolution of tools. For example, what debugger is
used to debug a debugger?


The first C++ compiler was written in C++. It compiled itself. From
Wikipedia:

"As Cfront was written in C++, it was a challenge to bootstrap on a
machine without a C++ compiler/translator. Along with the Cfront C++
sources, a special "half-preprocessed" version of the C code resulting
from compiling Cfront with itself was also provided.


So, how was the CFront that compiled the half processesd CFront code
used to compile CFront compiled?

Jun 15 '06 #17
Greg wrote:
Victor Bazarov wrote:
Greg wrote:
[...]
Actually the first C++ compiler was itself written in C++ - which
might sound like a chicken-and-egg impossibility were it not for one
fact: the first C++ compiler (CFront) did not actually compile C++
source code (including its own) directly - rather it first
translated C++ source code into C and then compiled the translated
sources with a C compiler. Pretty simple, isn't it?
I think you're confused. "Compile C++" and "translate C++" are
pretty much the same thing. So, how could it have been written in
C++? What would be used to translate its own code from C++ "into
C"? And if it wasn't used itself, what was used? And if, in fact,
some other thing was used, what do you call it if not "C++
translator"? And what was that thing written in? Catch my drift?
There is no "chicken and egg" problem. The "chicken and egg"
conundrum exists when there is circular dependency. There is none
here. First C++ compiler/translator was most likely written in C
(or C With Classes or some other predecessor of the "real C++").
After than each next version of a C++ compiler is written in C++
probably (because the C++ compiler programmers know C++ the best),
and any new advanced features the next version implements are simply
not used to write it (because the compiler does not support them).
That's just evolution of tools. For example, what debugger is used
to debug a debugger?


The first C++ compiler was written in C++. It compiled itself. From
Wikipedia:

"As Cfront was written in C++, it was a challenge to bootstrap on a
machine without a C++ compiler/translator. Along with the Cfront C++
sources,


....let's call them 'a'..
a special "half-preprocessed" version of the C code
....let's call it 'b'...
resulting
from compiling Cfront with itself
[huh! very interesting!]
was also provided. This C code was
to be compiled with the native C compiler, and the resulting
executable could then be used to compile the Cfront C++ sources."


I wasn't aware (although I now think it was unfounded) that Wikipedia
contains such convoluted and misleading "explanations".

How could Cfront compile itself?

struct Cfront {
CfrontSources a;
HalfProcessedC b;

Cfront() : a(typed_up()), b(Cfont().compile(Cfront())) {}
};

Take a look at the constructor initialiser list. Notice the recursion?
It's infinite!

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 15 '06 #18
Victor Bazarov wrote:
Greg wrote:
Victor Bazarov wrote:
Greg wrote:
[...]
Actually the first C++ compiler was itself written in C++ - which
might sound like a chicken-and-egg impossibility were it not for one
fact: the first C++ compiler (CFront) did not actually compile C++
source code (including its own) directly - rather it first
translated C++ source code into C and then compiled the translated
sources with a C compiler. Pretty simple, isn't it?

I think you're confused. "Compile C++" and "translate C++" are
pretty much the same thing. So, how could it have been written in
C++? What would be used to translate its own code from C++ "into
C"? And if it wasn't used itself, what was used? And if, in fact,
some other thing was used, what do you call it if not "C++
translator"? And what was that thing written in? Catch my drift?
There is no "chicken and egg" problem. The "chicken and egg"
conundrum exists when there is circular dependency. There is none
here. First C++ compiler/translator was most likely written in C
(or C With Classes or some other predecessor of the "real C++").
After than each next version of a C++ compiler is written in C++
probably (because the C++ compiler programmers know C++ the best),
and any new advanced features the next version implements are simply
not used to write it (because the compiler does not support them).
That's just evolution of tools. For example, what debugger is used
to debug a debugger?


The first C++ compiler was written in C++. It compiled itself. From
Wikipedia:

"As Cfront was written in C++, it was a challenge to bootstrap on a
machine without a C++ compiler/translator. Along with the Cfront C++
sources,


...let's call them 'a'..
a special "half-preprocessed" version of the C code


...let's call it 'b'...
resulting
from compiling Cfront with itself


[huh! very interesting!]
was also provided. This C code was
to be compiled with the native C compiler, and the resulting
executable could then be used to compile the Cfront C++ sources."


I wasn't aware (although I now think it was unfounded) that Wikipedia
contains such convoluted and misleading "explanations".

How could Cfront compile itself?


In principle, this is very easy: just run the first installation of Cfront
on hardware that runs C++ natively, e.g., employ a skilled human.
Best

Kai-Uwe Bux

Jun 15 '06 #19
Victor Bazarov wrote:
Greg wrote:
Victor Bazarov wrote:
Greg wrote:
[...]
Actually the first C++ compiler was itself written in C++ - which
might sound like a chicken-and-egg impossibility were it not for one
fact: the first C++ compiler (CFront) did not actually compile C++
source code (including its own) directly - rather it first
translated C++ source code into C and then compiled the translated
sources with a C compiler. Pretty simple, isn't it?

I think you're confused. "Compile C++" and "translate C++" are
pretty much the same thing. So, how could it have been written in
C++? What would be used to translate its own code from C++ "into
C"? And if it wasn't used itself, what was used? And if, in fact,
some other thing was used, what do you call it if not "C++
translator"? And what was that thing written in? Catch my drift?
There is no "chicken and egg" problem. The "chicken and egg"
conundrum exists when there is circular dependency. There is none
here. First C++ compiler/translator was most likely written in C
(or C With Classes or some other predecessor of the "real C++").
After than each next version of a C++ compiler is written in C++
probably (because the C++ compiler programmers know C++ the best),
and any new advanced features the next version implements are simply
not used to write it (because the compiler does not support them).
That's just evolution of tools. For example, what debugger is used
to debug a debugger?


The first C++ compiler was written in C++. It compiled itself. From
Wikipedia:

"As Cfront was written in C++, it was a challenge to bootstrap on a
machine without a C++ compiler/translator. Along with the Cfront C++
sources,


...let's call them 'a'..
a special "half-preprocessed" version of the C code


...let's call it 'b'...
resulting
from compiling Cfront with itself


[huh! very interesting!]
was also provided. This C code was
to be compiled with the native C compiler, and the resulting
executable could then be used to compile the Cfront C++ sources."


I wasn't aware (although I now think it was unfounded) that Wikipedia
contains such convoluted and misleading "explanations".

How could Cfront compile itself?

struct Cfront {
CfrontSources a;
HalfProcessedC b;

Cfront() : a(typed_up()), b(Cfont().compile(Cfront())) {}
};

Take a look at the constructor initialiser list. Notice the recursion?
It's infinite!


The very first version of Cfront was probably written in plain C. It
would just add one C with classes feature. The next version would
already make use of this one feature to implement the next feature.
Rinse repeat... This is called bootstrapping.

Eventually you end up with a fully fledged C++ compiler that compiles
itself.

What Wikipedia describes is not the bootstrapping process but what was
delivered to people so they could compile their own Cfront compiler.
The half preprocessed stuff would probably compile into a Cfront
version that would not implement all features but enough to compile the
Cfront C++ source.

Jun 15 '06 #20
Markus Schoder wrote:
Greg wrote:
> [...]
> Actually the first C++ compiler was itself written in C++ - which
> might sound like a chicken-and-egg impossibility were it not for
> one fact: the first C++ compiler (CFront) did not actually
> compile C++ source code (including its own) directly - rather it
> first translated C++ source code into C and then compiled the
> translated sources with a C compiler. Pretty simple, isn't it?

[...]

The very first version of Cfront was probably written in plain C.


Exactly my point. Thank you!
It
would just add one C with classes feature. The next version would
already make use of this one feature to implement the next feature.
Rinse repeat... This is called bootstrapping.
[..]


V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 15 '06 #21
Markus Schoder wrote:
Victor Bazarov wrote:
Greg wrote:
> Victor Bazarov wrote:
>> Greg wrote:
>>> [...]
>>> Actually the first C++ compiler was itself written in C++ - which
>>> might sound like a chicken-and-egg impossibility were it not for one
>>> fact: the first C++ compiler (CFront) did not actually compile C++
>>> source code (including its own) directly - rather it first
>>> translated C++ source code into C and then compiled the translated
>>> sources with a C compiler. Pretty simple, isn't it?
>>
>> I think you're confused. "Compile C++" and "translate C++" are
>> pretty much the same thing. So, how could it have been written in
>> C++? What would be used to translate its own code from C++ "into
>> C"? And if it wasn't used itself, what was used? And if, in fact,
>> some other thing was used, what do you call it if not "C++
>> translator"? And what was that thing written in? Catch my drift?
>> There is no "chicken and egg" problem. The "chicken and egg"
>> conundrum exists when there is circular dependency. There is none
>> here. First C++ compiler/translator was most likely written in C
>> (or C With Classes or some other predecessor of the "real C++").
>> After than each next version of a C++ compiler is written in C++
>> probably (because the C++ compiler programmers know C++ the best),
>> and any new advanced features the next version implements are simply
>> not used to write it (because the compiler does not support them).
>> That's just evolution of tools. For example, what debugger is used
>> to debug a debugger?
>
> The first C++ compiler was written in C++. It compiled itself. From
> Wikipedia:
>
> "As Cfront was written in C++, it was a challenge to bootstrap on a
> machine without a C++ compiler/translator. Along with the Cfront C++
> sources,


...let's call them 'a'..
> a special "half-preprocessed" version of the C code


...let's call it 'b'...
> resulting
> from compiling Cfront with itself


[huh! very interesting!]
> was also provided. This C code was
> to be compiled with the native C compiler, and the resulting
> executable could then be used to compile the Cfront C++ sources."


I wasn't aware (although I now think it was unfounded) that Wikipedia
contains such convoluted and misleading "explanations".

How could Cfront compile itself?

struct Cfront {
CfrontSources a;
HalfProcessedC b;

Cfront() : a(typed_up()), b(Cfont().compile(Cfront())) {}
};

Take a look at the constructor initialiser list. Notice the recursion?
It's infinite!


The very first version of Cfront was probably written in plain C. It
would just add one C with classes feature. The next version would
already make use of this one feature to implement the next feature.
Rinse repeat... This is called bootstrapping.

Eventually you end up with a fully fledged C++ compiler that compiles
itself.


Close, but why guess? Turns out, there is a first-hand account:

<quote "http://public.research.att.com/~bs/bs_faq.html#bootstrapping">
Which language did you use to write C++?

The first C++ compiler (Cfront) was written in C++. To build that, I first
used C to write a "C with Classes"-to-C preprocessor. "C with Classes" was
a C dialect that became the immediate ancestor to C++. That preprocessor
translated "C with Classes" constructs (such as classes and constructors)
into C. It was a traditional preprocessor in that it didn't undestand all
of the language, left most of the type checking for the C compiler to do,
and translated individual constructs without complete knowledge. I then
wrote the first version of Cfront in "C with Classes".

Cfront was a traditional compiler that did complete syntax and semantic
checking of the C++ source. For that, it had a complete parser, built
symbol tables, and built a complete internal tree representation of each
class, function, etc. It also did some source level optimization on its
internal tree representation of C++ constructs before outputting C. The
version that generated C, did not rely on C for any type checking. It
simply used C as an assembler. The resulting code was uncompromisingly
fast. For more information, see D&E.
</quote>
Best

Kai-Uwe Bux
Jun 15 '06 #22

Markus Schoder wrote:
Victor Bazarov wrote:
Greg wrote:
Victor Bazarov wrote:
> Greg wrote:
>> [...]
>> Actually the first C++ compiler was itself written in C++ - which
>> might sound like a chicken-and-egg impossibility were it not for one
>> fact: the first C++ compiler (CFront) did not actually compile C++
>> source code (including its own) directly - rather it first
>> translated C++ source code into C and then compiled the translated
>> sources with a C compiler. Pretty simple, isn't it?
>
> I think you're confused. "Compile C++" and "translate C++" are
> pretty much the same thing. So, how could it have been written in
> C++? What would be used to translate its own code from C++ "into
> C"? And if it wasn't used itself, what was used? And if, in fact,
> some other thing was used, what do you call it if not "C++
> translator"? And what was that thing written in? Catch my drift?
> There is no "chicken and egg" problem. The "chicken and egg"
> conundrum exists when there is circular dependency. There is none
> here. First C++ compiler/translator was most likely written in C
> (or C With Classes or some other predecessor of the "real C++").
> After than each next version of a C++ compiler is written in C++
> probably (because the C++ compiler programmers know C++ the best),
> and any new advanced features the next version implements are simply
> not used to write it (because the compiler does not support them).
> That's just evolution of tools. For example, what debugger is used
> to debug a debugger?

The first C++ compiler was written in C++. It compiled itself. From
Wikipedia:

"As Cfront was written in C++, it was a challenge to bootstrap on a
machine without a C++ compiler/translator. Along with the Cfront C++
sources,


...let's call them 'a'..
a special "half-preprocessed" version of the C code


...let's call it 'b'...
resulting
from compiling Cfront with itself


[huh! very interesting!]
was also provided. This C code was
to be compiled with the native C compiler, and the resulting
executable could then be used to compile the Cfront C++ sources."


I wasn't aware (although I now think it was unfounded) that Wikipedia
contains such convoluted and misleading "explanations".

How could Cfront compile itself?

struct Cfront {
CfrontSources a;
HalfProcessedC b;

Cfront() : a(typed_up()), b(Cfont().compile(Cfront())) {}
};

Take a look at the constructor initialiser list. Notice the recursion?
It's infinite!


The very first version of Cfront was probably written in plain C. It
would just add one C with classes feature. The next version would
already make use of this one feature to implement the next feature.
Rinse repeat... This is called bootstrapping.

Eventually you end up with a fully fledged C++ compiler that compiles
itself.

What Wikipedia describes is not the bootstrapping process but what was
delivered to people so they could compile their own Cfront compiler.
The half preprocessed stuff would probably compile into a Cfront
version that would not implement all features but enough to compile the
Cfront C++ source.


But you've completely forgotten about portability. Bootstrapping is
fine for a single platform but what happens when you want to bring the
only C++ compiler in the world to platform X? After all, the C++
language was meant to be portable, so it would make sense to design a
portable C++ compiler. But how can that be done easily when the
compiler itself is written in C++?

As I noted earlier, this is a classic chicken-and-egg problem: you have
the source code to a C++ compiler written in C++ but no other C++
compiler available with which to compile it on platform X. But because
CFront relied on C++ to C translation, it turns out that a C++ compiler
was not strictly needed to solve the problem. The solution employed was
to use a C compiler to compile the translated CFront sources in order
to build a C++ compiler on platform X that could then compile itself.

Greg

Jun 16 '06 #23

"Greg" <gr****@pacbell.net> skrev i meddelandet
news:11**********************@i40g2000cwc.googlegr oups.com...
..
But you've completely forgotten about portability. Bootstrapping is
fine for a single platform but what happens when you want to bring
the
only C++ compiler in the world to platform X? After all, the C++
language was meant to be portable, so it would make sense to design
a
portable C++ compiler. But how can that be done easily when the
compiler itself is written in C++?

As I noted earlier, this is a classic chicken-and-egg problem: you
have
the source code to a C++ compiler written in C++ but no other C++
compiler available with which to compile it on platform X. But
because
CFront relied on C++ to C translation, it turns out that a C++
compiler
was not strictly needed to solve the problem. The solution employed
was
to use a C compiler to compile the translated CFront sources in
order
to build a C++ compiler on platform X that could then compile
itself.


And now I just wonder how the first C compiler arrived to platform X?
Bo Persson
Jun 16 '06 #24
Greg wrote:
[...]
As I noted earlier, this is a classic chicken-and-egg problem: you
have the source code to a C++ compiler written in C++ but no other C++
compiler available with which to compile it on platform X. But because
CFront relied on C++ to C translation, it turns out that a C++
compiler was not strictly needed to solve the problem. The solution
employed was to use a C compiler to compile the translated CFront
sources [...]


Here we go again... "Translated CFront sources": translated *by what*?
And what do you call that thing?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 16 '06 #25

Victor Bazarov wrote:
Greg wrote:
[...]
As I noted earlier, this is a classic chicken-and-egg problem: you
have the source code to a C++ compiler written in C++ but no other C++
compiler available with which to compile it on platform X. But because
CFront relied on C++ to C translation, it turns out that a C++
compiler was not strictly needed to solve the problem. The solution
employed was to use a C compiler to compile the translated CFront
sources [...]


Here we go again... "Translated CFront sources": translated *by what*?
And what do you call that thing?


Well, except for the very first platform X you could just run CFront on
platform Y to get C sources and compile them on platform X. Don't know
if that is how they did it but you get the picture.

It's the first platform X that poses the problem.

Jun 16 '06 #26
Noah Roberts wrote:
Victor Bazarov wrote:
Greg wrote:
[...]
As I noted earlier, this is a classic chicken-and-egg problem: you
have the source code to a C++ compiler written in C++ but no other
C++ compiler available with which to compile it on platform X. But
because CFront relied on C++ to C translation, it turns out that a
C++ compiler was not strictly needed to solve the problem. The
solution employed was to use a C compiler to compile the translated
CFront sources [...]


Here we go again... "Translated CFront sources": translated *by
what*? And what do you call that thing?


Well, except for the very first platform X you could just run CFront
on platform Y to get C sources and compile them on platform X. Don't
know if that is how they did it but you get the picture.

It's the first platform X that poses the problem.


So, on the platform Y, CFront wasn't "written in C++", was it? It was
"written" then in C. And even if they were translated to C, they were
translated *somewhere*, right? So, there a C++ compiler/tranlsator had
to exist already. Now, how did that compiler/translator come into
existence? So, we simply need to eliminate multiple platforms from the
discussion. On the platform where CFront first appeared, what was it
written in? C with Classes (CwC), most likely. Now, the first CwC
compiler was written in C. First C compiler was written in B, and so on.
The first assembly language that translated symbolic instructions into
machine code was written probably in machine code directly...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 16 '06 #27

Victor Bazarov wrote:
The first assembly language that translated symbolic instructions into
machine code was written probably in machine code directly...


Naw man...

http://upload.wikimedia.org/wikipedi...b/Colossus.jpg

The first assemblers...

Jun 16 '06 #28
Noah Roberts wrote:
Victor Bazarov wrote:
The first assembly language that translated symbolic instructions
into machine code was written probably in machine code directly...


Naw man...

http://upload.wikimedia.org/wikipedi...b/Colossus.jpg

The first assemblers...


You mean the first assembler was born, not written?
Jun 16 '06 #29
The Colossus 'puter looks suspiciously like a Jacquard loom
(http://en.wikipedia.org/wiki/Jacquard_loom), which some historians of
technology consider the precursor to digital computers and may have
been the inspiration to Charles Babbage's Difference Engine!

Watch out: there's a bug in your Fruit of the Loom!

RL
Victor Bazarov wrote:
Noah Roberts wrote:
Victor Bazarov wrote:
The first assembly language that translated symbolic instructions
into machine code was written probably in machine code directly...


Naw man...

http://upload.wikimedia.org/wikipedi...b/Colossus.jpg

The first assemblers...


You mean the first assembler was born, not written?


Jun 16 '06 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Roy Hills | last post by:
When I'm reading from or writing to a network socket, I want to use a struct to represent the structured data, but must use an unsigned char buffer for the call to sendto() or recvfrom(). I have...
10
by: Rick Anderson | last post by:
All, I am receiving the following compilation error on LINUX (but not Solaris, HPUX, WIN32, etc): compiling osr.c LBFO.h(369): warning #64: declaration does not declare anything extern...
5
by: PCHOME | last post by:
Hello! I am working on dividing a single C file into several files. Now I encounter a problem about the global variables and can not find a way to solve it. All global variables and codes used...
19
by: Russell Shaw | last post by:
Hi, I have two structs in a header file, and they reference each other, causing a compile error. Is there a standard way to deal with this? typedef struct { ... RtAction *actions; }...
16
by: burn | last post by:
Hello, i am writing a program under linux in c and compile my code with make and gcc. Now i have 4 files: init.c/h and packets.c/h. Each header-file contains some: init.h: struct xyz {
5
by: Johs32 | last post by:
I have a struct "my_struct" and a function that as argument takes a pointer to this struct: struct my_struct{ struct my_struct *new; }; void my_func(struct my_struct *new); I have read...
7
by: Alex | last post by:
If I have two struct. See below: struct s1 { int type; int (*destroy)(struct s1* p); } struct s2 { struct s1 base;
4
by: hobbes992 | last post by:
Howdy folks, I've been working on a c project, compiling using gcc, and I've reached a problem. The assignment requires creation of a two-level directory file system. No files have to be added or...
4
by: hugo.arregui | last post by:
Hi! I have two struts like that: struct { int num; int num2; struct b arrayOfB; } a;
4
by: Sheldon | last post by:
Hi, I have a unique case where I need an array of structs that grows and within this array is another struct that grows in some cases. I'm having trouble allocating memory. Since I have never...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.