Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #12096 > unrolled thread

C++ source code compilation

Started bySheky <shekhar07.nitdgp@gmail.com>
First post2011-12-06 08:49 -0800
Last post2011-12-06 14:47 -0800
Articles 20 on this page of 133 — 19 participants

Back to article view | Back to comp.lang.c++


Contents

  C++ source code compilation Sheky <shekhar07.nitdgp@gmail.com> - 2011-12-06 08:49 -0800
    Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-06 17:06 +0000
      Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-07 07:39 +0000
        Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-07 14:11 +0000
        Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-07 17:37 +0000
          Re: C++ source code compilation ralph <nt_consulting64@yahoo.net> - 2011-12-07 12:28 -0600
            Re: C++ source code compilation 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-07 11:04 -0800
            Re: C++ source code compilation Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-12-07 19:53 +0000
              Re: C++ source code compilation Rui Maciel <rui.maciel@gmail.com> - 2011-12-07 20:41 +0000
                Re: C++ source code compilation Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-12-08 19:48 +0000
            Re: C++ source code compilation Robert Wessel <robertwessel2@yahoo.com> - 2011-12-07 14:56 -0600
              Re: C++ source code compilation ralph <nt_consulting64@yahoo.net> - 2011-12-07 16:09 -0600
            Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-07 22:27 +0000
              Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-08 09:28 +0000
                Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-08 13:39 +0000
                  Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 06:26 +0000
                    Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 10:55 +0000
            Re: C++ source code compilation Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-12-08 03:41 -0800
              Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-08 13:42 +0000
                Re: C++ source code compilation Rui Maciel <rui.maciel@gmail.com> - 2011-12-08 13:56 +0000
                  Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-08 14:11 +0000
                    Re: C++ source code compilation Rui Maciel <rui.maciel@gmail.com> - 2011-12-08 14:21 +0000
                      Re: C++ source code compilation gwowen <gwowen@gmail.com> - 2011-12-08 08:38 -0800
                        Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 00:39 +0000
                      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 00:31 +0000
                        Re: C++ source code compilation Rui Maciel <rui.maciel@gmail.com> - 2011-12-09 12:12 +0000
                    Re: C++ source code compilation 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-08 08:56 -0800
                Re: C++ source code compilation Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-12-09 05:23 -0800
                  Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 14:16 +0000
              Re: C++ source code compilation ralph <nt_consulting64@yahoo.net> - 2011-12-08 08:02 -0600
                Re: C++ source code compilation Robert Wessel <robertwessel2@yahoo.com> - 2011-12-08 13:18 -0600
                  Re: C++ source code compilation ralph <nt_consulting64@yahoo.net> - 2011-12-09 11:43 -0600
                    Re: C++ source code compilation Robert Wessel <robertwessel2@yahoo.com> - 2011-12-09 17:24 -0600
                      Re: C++ source code compilation ralph <nt_consulting64@yahoo.net> - 2011-12-09 18:06 -0600
      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-07 17:39 +0000
        Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-07 18:02 +0000
          Re: C++ source code compilation Robert Wessel <robertwessel2@yahoo.com> - 2011-12-07 14:58 -0600
          Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-07 22:20 +0000
            Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-07 22:42 +0000
              Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-08 01:54 +0000
            Re: C++ source code compilation John Bokma <john@castleamber.com> - 2011-12-07 16:55 -0600
              Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-07 22:58 +0000
                Re: C++ source code compilation John Bokma <john@castleamber.com> - 2011-12-07 20:52 -0600
                  Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-08 05:09 +0000
                  Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-08 05:15 +0000
                    Re: C++ source code compilation John Bokma <john@castleamber.com> - 2011-12-08 11:37 -0600
                      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 00:45 +0000
                  Re: C++ source code compilation Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-12-10 21:46 +0000
                  Re: C++ source code compilation Dombo <dombo@disposable.invalid> - 2011-12-11 16:01 +0100
              Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-08 01:59 +0000
                Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-08 09:35 +0000
                  Re: C++ source code compilation Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-08 12:43 -0600
                    Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 06:31 +0000
                      Re: C++ source code compilation Ian Collins <ian-news@hotmail.com> - 2011-12-09 19:40 +1300
                      Re: C++ source code compilation gwowen <gwowen@gmail.com> - 2011-12-08 23:47 -0800
                      Re: C++ source code compilation Paavo Helde <myfirstname@osa.pri.ee> - 2011-12-09 02:29 -0600
                    Re: C++ source code compilation Tobias Müller <troplin@bluewin.ch> - 2011-12-09 07:23 +0000
                      Re: C++ source code compilation gwowen <gwowen@gmail.com> - 2011-12-08 23:46 -0800
                      Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 09:24 +0000
                        Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 11:01 +0000
                          Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 12:23 +0000
                      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 10:58 +0000
                        Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 12:35 +0000
                          Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 12:44 +0000
                          Re: C++ source code compilation 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-09 04:55 -0800
                          Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 14:20 +0000
                            Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-09 14:33 +0000
                              Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 14:58 +0000
                                Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 15:11 +0000
                                  Re: C++ source code compilation Ian Collins <ian-news@hotmail.com> - 2011-12-10 07:59 +1300
                                Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-09 15:09 +0000
                                  Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 19:36 +0000
                                    Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-09 19:53 +0000
                                      Re: C++ source code compilation Ian Collins <ian-news@hotmail.com> - 2011-12-10 10:03 +1300
                                        Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-09 21:10 +0000
                                        Re: C++ source code compilation 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-09 14:06 -0800
                                        Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 23:04 +0000
                                      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 23:15 +0000
                                        Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-09 23:37 +0000
                                          Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 01:51 +0000
                                            Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-10 09:51 +0000
                                              Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 13:50 +0000
                                                Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-11 08:53 +0000
                                                  Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-11 20:17 +0000
                                            Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-10 12:37 +0000
                                              Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 13:45 +0000
                                                Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-10 13:49 +0000
                                                  Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 14:37 +0000
                                                    Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-11 08:55 +0000
                                                Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-10 14:07 +0000
                                                  Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 14:28 +0000
                                                    Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-10 14:50 +0000
                                                      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 14:54 +0000
                                                        Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-10 15:17 +0000
                                                          Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 18:13 +0000
                                                            Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-10 18:36 +0000
                                                              Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 22:34 +0000
                                                                Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-10 22:46 +0000
                                                                  Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 23:25 +0000
                                                                    Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-10 23:30 +0000
                                                                      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-11 03:23 +0000
                                                                        Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-11 09:12 +0000
                                                                          Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-12 10:05 +0000
                                                                            Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-12 12:05 +0000
                                                                              Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-12 12:58 +0000
                                                                        Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-11 13:29 +0000
                                                                          Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-11 20:33 +0000
                                                                        Re: C++ source code compilation 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-11 07:14 -0800
                                                                    Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-11 09:07 +0000
                                                    Re: C++ source code compilation Tobias Müller <troplin@bluewin.ch> - 2011-12-10 14:52 +0000
                                                      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-10 15:24 +0000
                                                        Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-11 09:05 +0000
                                                    Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-11 09:01 +0000
                                                      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-11 20:22 +0000
                                                        Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-12 10:11 +0000
                              Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 15:08 +0000
                          Re: C++ source code compilation Rui Maciel <rui.maciel@gmail.com> - 2011-12-09 15:08 +0000
                Re: C++ source code compilation 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-08 02:53 -0800
                  Re: C++ source code compilation Robert Wessel <robertwessel2@yahoo.com> - 2011-12-08 05:16 -0600
                    Re: C++ source code compilation 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-08 03:50 -0800
                      Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-08 14:01 +0000
                        Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 06:35 +0000
                          Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-09 11:06 +0000
                            Re: C++ source code compilation Juha Nieminen <nospam@thanks.invalid> - 2011-12-09 12:38 +0000
            Re: C++ source code compilation Paul N <gw7rib@aol.com> - 2011-12-11 12:41 -0800
              Re: C++ source code compilation Leigh Johnston <leigh@i42.co.uk> - 2011-12-11 21:02 +0000
              Re: C++ source code compilation "Paul" <pchrist<nospam>or@yahoo.co.uk> - 2011-12-12 02:19 +0000
                Re: C++ source code compilation 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-11 20:02 -0800
    Re: C++ source code compilation red floyd <no.spam.here@its.invalid> - 2011-12-06 09:15 -0800
      Re: C++ source code compilation Sheky <shekhar07.nitdgp@gmail.com> - 2011-12-06 10:29 -0800
        Re: C++ source code compilation Robert Wessel <robertwessel2@yahoo.com> - 2011-12-06 12:39 -0600
          Re: C++ source code compilation Victor Bazarov <v.bazarov@comcast.invalid> - 2011-12-06 13:51 -0500
    Re: C++ source code compilation Paul N <gw7rib@aol.com> - 2011-12-06 14:47 -0800

Page 1 of 7  [1] 2 3 4 5 6 7  Next page →


#12096 — C++ source code compilation

FromSheky <shekhar07.nitdgp@gmail.com>
Date2011-12-06 08:49 -0800
SubjectC++ source code compilation
Message-ID<ebe43093-5bbb-4a73-a059-b7c51db1a3a8@l24g2000yqm.googlegroups.com>
Could anyone please answer if every C++ programs get converted to
equivalent C code during compilation ? Thank you.

[toc] | [next] | [standalone]


#12097

FromLeigh Johnston <leigh@i42.co.uk>
Date2011-12-06 17:06 +0000
Message-ID<-66dnSWxcIcy1kPTnZ2dnUVZ8sOdnZ2d@giganews.com>
In reply to#12096
On 06/12/2011 16:49, Sheky wrote:
> Could anyone please answer if every C++ programs get converted to
> equivalent C code during compilation ? Thank you.

Some early C++ compilers worked this way but I suspect very few modern 
C++ compilers produce C as an intermediate but rather create machine 
code directly.

/Leigh

[toc] | [prev] | [next] | [standalone]


#12107

FromJuha Nieminen <nospam@thanks.invalid>
Date2011-12-07 07:39 +0000
Message-ID<4edf181e$0$2821$7b1e8fa0@news.nbl.fi>
In reply to#12097
Leigh Johnston <leigh@i42.co.uk> wrote:
> On 06/12/2011 16:49, Sheky wrote:
>> Could anyone please answer if every C++ programs get converted to
>> equivalent C code during compilation ? Thank you.
> 
> Some early C++ compilers worked this way but I suspect very few modern 
> C++ compilers produce C as an intermediate but rather create machine 
> code directly.

  Actually compilers, especially those supporting many languages (such as
gcc) probably produce a kind of "intermediate" form (which is more or less
common to all the languages that the compiler supports), which is then
optimized and compiled into asm. (This intermediate form isn't a programming
language per se, but usually some tokenized and "half-compiled" tree data in
binary form, or similar.)

  Anyways, converting a C++ program into C and then compiling that C would
be inefficient, complicated and produce a less efficient result (because
the compiler cannot use its knowledge of the C++ syntax in order to better
optimize the code), so it would make little sense.

  (As an example, I'm guessing that exception handling is impossible to
convert into C code so that it would be as efficient as when compiling
C++ directly. C++ exceptions are designed so that if no exception is
thrown, the code will be as efficient as if no exceptions were in use
at all. I think this would be impossible to express in C.)

[toc] | [prev] | [next] | [standalone]


#12115

FromLeigh Johnston <leigh@i42.co.uk>
Date2011-12-07 14:11 +0000
Message-ID<K5udnatCeKez6ULTnZ2dnUVZ8qednZ2d@giganews.com>
In reply to#12107
On 07/12/2011 07:39, Juha Nieminen wrote:
> Leigh Johnston<leigh@i42.co.uk>  wrote:
>> On 06/12/2011 16:49, Sheky wrote:
>>> Could anyone please answer if every C++ programs get converted to
>>> equivalent C code during compilation ? Thank you.
>>
>> Some early C++ compilers worked this way but I suspect very few modern
>> C++ compilers produce C as an intermediate but rather create machine
>> code directly.
>
>    Actually compilers, especially those supporting many languages (such as
> gcc) probably produce a kind of "intermediate" form (which is more or less
> common to all the languages that the compiler supports), which is then
> optimized and compiled into asm. (This intermediate form isn't a programming
> language per se, but usually some tokenized and "half-compiled" tree data in
> binary form, or similar.)
>
>    Anyways, converting a C++ program into C and then compiling that C would
> be inefficient, complicated and produce a less efficient result (because
> the compiler cannot use its knowledge of the C++ syntax in order to better
> optimize the code), so it would make little sense.
>
>    (As an example, I'm guessing that exception handling is impossible to
> convert into C code so that it would be as efficient as when compiling
> C++ directly. C++ exceptions are designed so that if no exception is
> thrown, the code will be as efficient as if no exceptions were in use
> at all. I think this would be impossible to express in C.)

This intermediate form you speak of is usually internal to the compiler 
whereas the OP specifically asked about compilers that produce C code 
which is then also compiled.

/Leigh

[toc] | [prev] | [next] | [standalone]


#12117

From"Paul" <pchrist<nospam>or@yahoo.co.uk>
Date2011-12-07 17:37 +0000
Message-ID<jbo896$2pf3$1@adenine.netfront.net>
In reply to#12107
"Juha Nieminen" <nospam@thanks.invalid> wrote in message 
news:4edf181e$0$2821$7b1e8fa0@news.nbl.fi...
> Leigh Johnston <leigh@i42.co.uk> wrote:
>> On 06/12/2011 16:49, Sheky wrote:
>>> Could anyone please answer if every C++ programs get converted to
>>> equivalent C code during compilation ? Thank you.
>>
>> Some early C++ compilers worked this way but I suspect very few modern
>> C++ compilers produce C as an intermediate but rather create machine
>> code directly.
>
>  Actually compilers, especially those supporting many languages (such as
> gcc) probably produce a kind of "intermediate" form (which is more or less
> common to all the languages that the compiler supports), which is then
> optimized and compiled into asm. (This intermediate form isn't a 
> programming
> language per se, but usually some tokenized and "half-compiled" tree data 
> in
> binary form, or similar.)

Are you suggesting that C++ compilers convert the code to asm, then this asm 
code is convert to object code?

>
>  Anyways, converting a C++ program into C and then compiling that C would
> be inefficient, complicated and produce a less efficient result (because
> the compiler cannot use its knowledge of the C++ syntax in order to better
> optimize the code), so it would make little sense.
>
>  (As an example, I'm guessing that exception handling is impossible to
> convert into C code so that it would be as efficient as when compiling
> C++ directly. C++ exceptions are designed so that if no exception is
> thrown, the code will be as efficient as if no exceptions were in use
> at all. I think this would be impossible to express in C.)

Would the same not apply with asm?



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#12120

Fromralph <nt_consulting64@yahoo.net>
Date2011-12-07 12:28 -0600
Message-ID<3iavd7teopcqd2ar846trba102n1a3q27n@4ax.com>
In reply to#12117
On Wed, 7 Dec 2011 17:37:14 -0000, "Paul"
<pchrist<nospam>or@yahoo.co.uk> wrote:

>
>"Juha Nieminen" <nospam@thanks.invalid> wrote in message 
>news:4edf181e$0$2821$7b1e8fa0@news.nbl.fi...
>> Leigh Johnston <leigh@i42.co.uk> wrote:
>>> On 06/12/2011 16:49, Sheky wrote:
>>>> Could anyone please answer if every C++ programs get converted to
>>>> equivalent C code during compilation ? Thank you.
>>>
>>> Some early C++ compilers worked this way but I suspect very few modern
>>> C++ compilers produce C as an intermediate but rather create machine
>>> code directly.
>>
>>  Actually compilers, especially those supporting many languages (such as
>> gcc) probably produce a kind of "intermediate" form (which is more or less
>> common to all the languages that the compiler supports), which is then
>> optimized and compiled into asm. (This intermediate form isn't a 
>> programming
>> language per se, but usually some tokenized and "half-compiled" tree data 
>> in
>> binary form, or similar.)
>
>Are you suggesting that C++ compilers convert the code to asm, then this asm 
>code is convert to object code?
>

Not exactly what he is suggesting, but in process of compiling by
mainstream compilers (GCC, VC++, Borland, ...) there is a step in
which preprocessed C++ code is converted to assembly. The assembler
then converts the 'asm' code into object code.

>>
>>  Anyways, converting a C++ program into C and then compiling that C would
>> be inefficient, complicated and produce a less efficient result (because
>> the compiler cannot use its knowledge of the C++ syntax in order to better
>> optimize the code), so it would make little sense.
>>
>>  (As an example, I'm guessing that exception handling is impossible to
>> convert into C code so that it would be as efficient as when compiling
>> C++ directly. C++ exceptions are designed so that if no exception is
>> thrown, the code will be as efficient as if no exceptions were in use
>> at all. I think this would be impossible to express in C.)
>
>Would the same not apply with asm?
>

Not really. Or rather there is no asm that couldn't be
reverse-engineered back into an equivalent expression in another
higher-level language.

Thus while performing a C++ to C conversion at the source code level
would likely lead to a complete mental collapse, a C++ to asm then asm
to C would be doable - though definitely non-trivial.

-ralph

[toc] | [prev] | [next] | [standalone]


#12122

From88888 Dihedral <dihedral88888@googlemail.com>
Date2011-12-07 11:04 -0800
Message-ID<17863313.475.1323284650416.JavaMail.geo-discussion-forums@pril5>
In reply to#12120
On Thursday, December 8, 2011 2:28:29 AM UTC+8, ralph wrote:
> On Wed, 7 Dec 2011 17:37:14 -0000, "Paul"
> 
> o...@yahoo.co.uk> wrote:
> 
> >
> >"Juha Nieminen" <nospam@thanks.invalid> wrote in message 
> >news:4edf181e$0$2821$7b1e8fa0@news.nbl.fi...
> >> Leigh Johnston <le...@i42.co.uk> wrote:
> >>> On 06/12/2011 16:49, Sheky wrote:
> >>>> Could anyone please answer if every C++ programs get converted to
> >>>> equivalent C code during compilation ? Thank you.
> >>>
> >>> Some early C++ compilers worked this way but I suspect very few modern
> >>> C++ compilers produce C as an intermediate but rather create machine
> >>> code directly.
> >>
> >>  Actually compilers, especially those supporting many languages (such as
> >> gcc) probably produce a kind of "intermediate" form (which is more or less
> >> common to all the languages that the compiler supports), which is then
> >> optimized and compiled into asm. (This intermediate form isn't a 
> >> programming
> >> language per se, but usually some tokenized and "half-compiled" tree data 
> >> in
> >> binary form, or similar.)
> >
> >Are you suggesting that C++ compilers convert the code to asm, then this asm 
> >code is convert to object code?
> >

What the byte code compiler in C++ and C are different?

That is funny at all. A tree pass compiler in C++/C with local limited  optimization only and can't be inserted with assembly code directly 
is weired. 

Objects are just decorated syntax sugars for structures and function pointers
as stated  clearly in the FAQ in this news group. 


 
> Not exactly what he is suggesting, but in process of compiling by
> mainstream compilers (GCC, VC++, Borland, ...) there is a step in
> which preprocessed C++ code is converted to assembly. The assembler
> then converts the 'asm' code into object code.
> 
> >>
> >>  Anyways, converting a C++ program into C and then compiling that C would
> >> be inefficient, complicated and produce a less efficient result (because
> >> the compiler cannot use its knowledge of the C++ syntax in order to better
> >> optimize the code), so it would make little sense.
> >>
> >>  (As an example, I'm guessing that exception handling is impossible to
> >> convert into C code so that it would be as efficient as when compiling
> >> C++ directly. C++ exceptions are designed so that if no exception is
> >> thrown, the code will be as efficient as if no exceptions were in use
> >> at all. I think this would be impossible to express in C.)
> >
> >Would the same not apply with asm?
> >
> 
> Not really. Or rather there is no asm that couldn't be
> reverse-engineered back into an equivalent expression in another
> higher-level language.
> 
> Thus while performing a C++ to C conversion at the source code level
> would likely lead to a complete mental collapse, a C++ to asm then asm
> to C would be doable - though definitely non-trivial.
> 
> -ralph

[toc] | [prev] | [next] | [standalone]


#12123

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2011-12-07 19:53 +0000
Message-ID<slrnjdvh17.q8l.grahn+nntp@frailea.sa.invalid>
In reply to#12120
On Wed, 2011-12-07, ralph wrote:
> On Wed, 7 Dec 2011 17:37:14 -0000, "Paul"
> <pchrist<nospam>or@yahoo.co.uk> wrote:
>
>>
>>"Juha Nieminen" <nospam@thanks.invalid> wrote in message 
>>news:4edf181e$0$2821$7b1e8fa0@news.nbl.fi...
>>> Leigh Johnston <leigh@i42.co.uk> wrote:
>>>> On 06/12/2011 16:49, Sheky wrote:
>>>>> Could anyone please answer if every C++ programs get converted to
>>>>> equivalent C code during compilation ? Thank you.
>>>>
>>>> Some early C++ compilers worked this way but I suspect very few modern
>>>> C++ compilers produce C as an intermediate but rather create machine
>>>> code directly.
>>>
>>>  Actually compilers, especially those supporting many languages (such as
>>> gcc) probably produce a kind of "intermediate" form (which is more or less
>>> common to all the languages that the compiler supports), which is then
>>> optimized and compiled into asm. (This intermediate form isn't a 
>>> programming
>>> language per se, but usually some tokenized and "half-compiled" tree data 
>>> in
>>> binary form, or similar.)
>>
>>Are you suggesting that C++ compilers convert the code to asm, then this asm 
>>code is convert to object code?
>>
>
> Not exactly what he is suggesting, but in process of compiling by
> mainstream compilers (GCC, VC++, Borland, ...) there is a step in
> which preprocessed C++ code is converted to assembly. The assembler
> then converts the 'asm' code into object code.

Are you sure of that?  Going to (e.g.) x86 assembly language and then
invoking the assembler to get x86 object code seems unnecessary
complication.  I don't see it mentioned in the "GCC internals" document.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

[toc] | [prev] | [next] | [standalone]


#12125

FromRui Maciel <rui.maciel@gmail.com>
Date2011-12-07 20:41 +0000
Message-ID<jboj12$pha$1@speranza.aioe.org>
In reply to#12123
Jorgen Grahn wrote:

> Are you sure of that?  Going to (e.g.) x86 assembly language and then
> invoking the assembler to get x86 object code seems unnecessary
> complication.  I don't see it mentioned in the "GCC internals" document.

He is right.  GCC is notoriously organized in front-ends, which translate 
any given programming language into an intermediate language which is 
supported by GCC (it appears to support at least 3 intermediate languages), 
and back-ends, which translate code written in those intermediate languages 
into machine code for a specific target platform. 

This approach may appear an "unnecessary complication" at first.  Yet, this 
approach means, at least in theory, that you only need to write a new GCC 
front-end in order to get your new programming language to be supported in 
every platform supported by GCC, and it also means that you only need to 
write a new GCC back-end in order to offer support for each and every 
programming language supported by GCC in a brand new target architecture.

Also, by relying on an intermediate implementation it is also possible to 
perform all sorts of code optimization on a single piece of data and yet 
reap benefits from that optimization when writing code in any programming 
language supported by GCC and when targetting any platform supported by GCC.


Hope this helps,
Rui Maciel

[toc] | [prev] | [next] | [standalone]


#12208

FromJorgen Grahn <grahn+nntp@snipabacken.se>
Date2011-12-08 19:48 +0000
Message-ID<slrnje253s.q8l.grahn+nntp@frailea.sa.invalid>
In reply to#12125
On Wed, 2011-12-07, Rui Maciel wrote:
> Jorgen Grahn wrote:
>
>> Are you sure of that?  Going to (e.g.) x86 assembly language and then
>> invoking the assembler to get x86 object code seems unnecessary
>> complication.  I don't see it mentioned in the "GCC internals" document.
>
> He is right.  GCC is notoriously organized in front-ends, which translate 
> any given programming language into an intermediate language which is 
> supported by GCC (it appears to support at least 3 intermediate languages), 
> and back-ends, which translate code written in those intermediate languages 
> into machine code for a specific target platform. 
>
> This approach may appear an "unnecessary complication" at first.  Yet, this 
> approach means, at least in theory, that you only need to write a new GCC 
> front-end in order to get your new programming language to be supported in 
> every platform supported by GCC, and it also means that you only need to 
> write a new GCC back-end in order to offer support for each and every 
> programming language supported by GCC in a brand new target architecture.
>
> Also, by relying on an intermediate implementation it is also possible to 
> perform all sorts of code optimization on a single piece of data and yet 
> reap benefits from that optimization when writing code in any programming 
> language supported by GCC and when targetting any platform supported by GCC.

I am aware of all this, but passing through the stage "x86 assembly
source code" (which was what someone suggested, in the part you
snipped) brings none of the benefits you mention. I don't think it's
done.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .

[toc] | [prev] | [next] | [standalone]


#12126

FromRobert Wessel <robertwessel2@yahoo.com>
Date2011-12-07 14:56 -0600
Message-ID<7lkvd7pbrgcshisf7o7k2mod5ibppep5je@4ax.com>
In reply to#12120
On Wed, 07 Dec 2011 12:28:29 -0600, ralph <nt_consulting64@yahoo.net>
wrote:

>On Wed, 7 Dec 2011 17:37:14 -0000, "Paul"
><pchrist<nospam>or@yahoo.co.uk> wrote:
>
>>
>>"Juha Nieminen" <nospam@thanks.invalid> wrote in message 
>>news:4edf181e$0$2821$7b1e8fa0@news.nbl.fi...
>>> Leigh Johnston <leigh@i42.co.uk> wrote:
>>>> On 06/12/2011 16:49, Sheky wrote:
>>>>> Could anyone please answer if every C++ programs get converted to
>>>>> equivalent C code during compilation ? Thank you.
>>>>
>>>> Some early C++ compilers worked this way but I suspect very few modern
>>>> C++ compilers produce C as an intermediate but rather create machine
>>>> code directly.
>>>
>>>  Actually compilers, especially those supporting many languages (such as
>>> gcc) probably produce a kind of "intermediate" form (which is more or less
>>> common to all the languages that the compiler supports), which is then
>>> optimized and compiled into asm. (This intermediate form isn't a 
>>> programming
>>> language per se, but usually some tokenized and "half-compiled" tree data 
>>> in
>>> binary form, or similar.)
>>
>>Are you suggesting that C++ compilers convert the code to asm, then this asm 
>>code is convert to object code?
>>
>
>Not exactly what he is suggesting, but in process of compiling by
>mainstream compilers (GCC, VC++, Borland, ...) there is a step in
>which preprocessed C++ code is converted to assembly. The assembler
>then converts the 'asm' code into object code.


So do, some don't.  IIRC, GCC, for example, does, MSVC does not.

[toc] | [prev] | [next] | [standalone]


#12129

Fromralph <nt_consulting64@yahoo.net>
Date2011-12-07 16:09 -0600
Message-ID<islvd7di76qmvh4l5jg2pig0eb8me1dc6g@4ax.com>
In reply to#12126
On Wed, 07 Dec 2011 14:56:21 -0600, Robert Wessel
<robertwessel2@yahoo.com> wrote:

>On Wed, 07 Dec 2011 12:28:29 -0600, ralph <nt_consulting64@yahoo.net>
>wrote:
>
>>On Wed, 7 Dec 2011 17:37:14 -0000, "Paul"
>><pchrist<nospam>or@yahoo.co.uk> wrote:
>>
>>>
>>>"Juha Nieminen" <nospam@thanks.invalid> wrote in message 
>>>news:4edf181e$0$2821$7b1e8fa0@news.nbl.fi...
>>>> Leigh Johnston <leigh@i42.co.uk> wrote:
>>>>> On 06/12/2011 16:49, Sheky wrote:
>>>>>> Could anyone please answer if every C++ programs get converted to
>>>>>> equivalent C code during compilation ? Thank you.
>>>>>
>>>>> Some early C++ compilers worked this way but I suspect very few modern
>>>>> C++ compilers produce C as an intermediate but rather create machine
>>>>> code directly.
>>>>
>>>>  Actually compilers, especially those supporting many languages (such as
>>>> gcc) probably produce a kind of "intermediate" form (which is more or less
>>>> common to all the languages that the compiler supports), which is then
>>>> optimized and compiled into asm. (This intermediate form isn't a 
>>>> programming
>>>> language per se, but usually some tokenized and "half-compiled" tree data 
>>>> in
>>>> binary form, or similar.)
>>>
>>>Are you suggesting that C++ compilers convert the code to asm, then this asm 
>>>code is convert to object code?
>>>
>>
>>Not exactly what he is suggesting, but in process of compiling by
>>mainstream compilers (GCC, VC++, Borland, ...) there is a step in
>>which preprocessed C++ code is converted to assembly. The assembler
>>then converts the 'asm' code into object code.
>
>
>So do, some don't.  IIRC, GCC, for example, does, MSVC does not.

Yeah, I did make is sound like they all output .ASM files. MSVC
doesn't unless requested.

But here is where we will likely get into a semantics war over
"passes", "assembler", and "machine code". <g>

First off consider what is "asm"? It is merely decorated machine code
formatted into sections to be human or favorite Assembler readable and
output to a file. If that is your definition, then MSVC skips that.
What it produces from preprocessed source code is a formatted, binary
equivalent - the .obj. That pass is called the "assembler".

You can get MSVC to output formatted .ASM with a compiler switch. Not
a very complex process as it just re-formats its internal binary
representation to text. Furthermore, you can use that .ASM file as a
full replacement in later operations. Which to me demonstrates the
only difference is formatting.

The GCC outputs a documented file, MSVC keeps its cards a little
closer to the vest, but its there. They all go through an "assembly"
phase.

-ralph

[toc] | [prev] | [next] | [standalone]


#12131

From"Paul" <pchrist<nospam>or@yahoo.co.uk>
Date2011-12-07 22:27 +0000
Message-ID<jbop8v$7ui$1@adenine.netfront.net>
In reply to#12120
"ralph" <nt_consulting64@yahoo.net> wrote in message 
news:3iavd7teopcqd2ar846trba102n1a3q27n@4ax.com...
> On Wed, 7 Dec 2011 17:37:14 -0000, "Paul"
> <pchrist<nospam>or@yahoo.co.uk> wrote:
>
>>
>>"Juha Nieminen" <nospam@thanks.invalid> wrote in message
>>news:4edf181e$0$2821$7b1e8fa0@news.nbl.fi...
>>> Leigh Johnston <leigh@i42.co.uk> wrote:
>>>> On 06/12/2011 16:49, Sheky wrote:
>>>>> Could anyone please answer if every C++ programs get converted to
>>>>> equivalent C code during compilation ? Thank you.
>>>>
>>>> Some early C++ compilers worked this way but I suspect very few modern
>>>> C++ compilers produce C as an intermediate but rather create machine
>>>> code directly.
>>>
>>>  Actually compilers, especially those supporting many languages (such as
>>> gcc) probably produce a kind of "intermediate" form (which is more or 
>>> less
>>> common to all the languages that the compiler supports), which is then
>>> optimized and compiled into asm. (This intermediate form isn't a
>>> programming
>>> language per se, but usually some tokenized and "half-compiled" tree 
>>> data
>>> in
>>> binary form, or similar.)
>>
>>Are you suggesting that C++ compilers convert the code to asm, then this 
>>asm
>>code is convert to object code?
>>
>
> Not exactly what he is suggesting, but in process of compiling by
> mainstream compilers (GCC, VC++, Borland, ...) there is a step in
> which preprocessed C++ code is converted to assembly. The assembler
> then converts the 'asm' code into object code.

You just said the same as what I said
>
>>>
>>>  Anyways, converting a C++ program into C and then compiling that C 
>>> would
>>> be inefficient, complicated and produce a less efficient result (because
>>> the compiler cannot use its knowledge of the C++ syntax in order to 
>>> better
>>> optimize the code), so it would make little sense.
>>>
>>>  (As an example, I'm guessing that exception handling is impossible to
>>> convert into C code so that it would be as efficient as when compiling
>>> C++ directly. C++ exceptions are designed so that if no exception is
>>> thrown, the code will be as efficient as if no exceptions were in use
>>> at all. I think this would be impossible to express in C.)
>>
>>Would the same not apply with asm?
>>
>
> Not really. Or rather there is no asm that couldn't be
> reverse-engineered back into an equivalent expression in another
> higher-level language.
>
> Thus while performing a C++ to C conversion at the source code level
> would likely lead to a complete mental collapse, a C++ to asm then asm
> to C would be doable - though definitely non-trivial.
>

You can't implement C++ exception hadling in asm.
Functions that throw in object files etc, I don't think its as simple as you 
make out. Anyways where do you stand on this , are you also suggesting that 
compilers simply wrap an assembler? 



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#12154

FromJuha Nieminen <nospam@thanks.invalid>
Date2011-12-08 09:28 +0000
Message-ID<4ee0833c$0$4394$7b1e8fa0@news.nbl.fi>
In reply to#12131
"Paul" <pchrist <nospam>or@yahoo.co.uk> wrote:
> You can't implement C++ exception hadling in asm.

  That's equivalent to saying that you can't implement C++ exception
handling in machine code. Or, in other words, that C++ cannot be compiled
(at least not C++ that has exception handling).

[toc] | [prev] | [next] | [standalone]


#12167

From"Paul" <pchrist<nospam>or@yahoo.co.uk>
Date2011-12-08 13:39 +0000
Message-ID<jbqemd$2mv8$1@adenine.netfront.net>
In reply to#12154
"Juha Nieminen" <nospam@thanks.invalid> wrote in message 
news:4ee0833c$0$4394$7b1e8fa0@news.nbl.fi...
> "Paul" <pchrist <nospam>or@yahoo.co.uk> wrote:
>> You can't implement C++ exception hadling in asm.
>
>  That's equivalent to saying that you can't implement C++ exception
> handling in machine code. Or, in other words, that C++ cannot be compiled
> (at least not C++ that has exception handling).

asm is the closest thing to cpu intructions, what i call opcodes. And I more 
or less agree that anything you can do in C++ can be done in asm but I 
wouldn't be too fast to jump into an argument about that.

But the main point is that the compilation process nothing to do with 
machine code, the compiler comiles to object code. So asm doesn't come into 
the equation. 



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#12232

FromJuha Nieminen <nospam@thanks.invalid>
Date2011-12-09 06:26 +0000
Message-ID<4ee1aa19$0$2805$7b1e8fa0@news.nbl.fi>
In reply to#12167
"Paul" <pchrist <nospam>or@yahoo.co.uk> wrote:
> 
> "Juha Nieminen" <nospam@thanks.invalid> wrote in message 
> news:4ee0833c$0$4394$7b1e8fa0@news.nbl.fi...
>> "Paul" <pchrist <nospam>or@yahoo.co.uk> wrote:
>>> You can't implement C++ exception hadling in asm.
>>
>>  That's equivalent to saying that you can't implement C++ exception
>> handling in machine code. Or, in other words, that C++ cannot be compiled
>> (at least not C++ that has exception handling).
> 
> asm is the closest thing to cpu intructions, what i call opcodes. And I more 
> or less agree that anything you can do in C++ can be done in asm but I 
> wouldn't be too fast to jump into an argument about that.
> 
> But the main point is that the compilation process nothing to do with 
> machine code, the compiler comiles to object code. So asm doesn't come into 
> the equation. 

  Is that your way of saying "I was wrong, you are right"?

[toc] | [prev] | [next] | [standalone]


#12246

From"Paul" <pchrist<nospam>or@yahoo.co.uk>
Date2011-12-09 10:55 +0000
Message-ID<jbspef$2edl$1@adenine.netfront.net>
In reply to#12232
"Juha Nieminen" <nospam@thanks.invalid> wrote in message 
news:4ee1aa19$0$2805$7b1e8fa0@news.nbl.fi...
> "Paul" <pchrist <nospam>or@yahoo.co.uk> wrote:
>>
>> "Juha Nieminen" <nospam@thanks.invalid> wrote in message
>> news:4ee0833c$0$4394$7b1e8fa0@news.nbl.fi...
>>> "Paul" <pchrist <nospam>or@yahoo.co.uk> wrote:
>>>> You can't implement C++ exception hadling in asm.
>>>
>>>  That's equivalent to saying that you can't implement C++ exception
>>> handling in machine code. Or, in other words, that C++ cannot be 
>>> compiled
>>> (at least not C++ that has exception handling).
>>
>> asm is the closest thing to cpu intructions, what i call opcodes. And I 
>> more
>> or less agree that anything you can do in C++ can be done in asm but I
>> wouldn't be too fast to jump into an argument about that.
>>
>> But the main point is that the compilation process nothing to do with
>> machine code, the compiler comiles to object code. So asm doesn't come 
>> into
>> the equation.
>
>  Is that your way of saying "I was wrong, you are right"?

No its my way of saying ... if you are trying to say that object code is 
machine code then you are wrong. 



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#12161

FromNick Keighley <nick_keighley_nospam@hotmail.com>
Date2011-12-08 03:41 -0800
Message-ID<39385b47-31ee-4e0c-ac37-368b5291d354@m10g2000vbc.googlegroups.com>
In reply to#12120
On Dec 7, 6:28 pm, ralph <nt_consultin...@yahoo.net> wrote:
> On Wed, 7 Dec 2011 17:37:14 -0000, "Paul"
> <pchrist<nospam>o...@yahoo.co.uk> wrote:
>
> >"Juha Nieminen" <nos...@thanks.invalid> wrote in message
> >news:4edf181e$0$2821$7b1e8fa0@news.nbl.fi...
> >> Leigh Johnston <le...@i42.co.uk> wrote:
> >>> On 06/12/2011 16:49, Sheky wrote:


> >>>> Could anyone please answer if every C++ programs get converted to
> >>>> equivalent C code during compilation ? Thank you.

no. Not all C++ compilers use C as an intermediate language. I
understand very few do. It's slow and (I understand- IANA compiler
writer) C isn't a particularly good intermediate language.

> >>> Some early C++ compilers worked this way but I suspect very few modern
> >>> C++ compilers produce C as an intermediate but rather create machine
> >>> code directly.
>
> >>  Actually compilers, especially those supporting many languages (such as
> >> gcc) probably produce a kind of "intermediate" form (which is more or less
> >> common to all the languages that the compiler supports), which is then
> >> optimized and compiled into asm.

or directly into machine code.


> >> (This intermediate form isn't a
> >> programming
> >> language per se, but usually some tokenized and "half-compiled" tree data
> >> in
> >> binary form, or similar.)
>
> >Are you suggesting that C++ compilers convert the code to asm, then this asm
> >code is convert to object code?
>
> Not exactly what he is suggesting, but in process of compiling by
> mainstream compilers (GCC, VC++, Borland, ...) there is a step in
> which preprocessed C++ code is converted to assembly. The assembler
> then converts the 'asm' code into object code.
>
>
>
> >>  Anyways, converting a C++ program into C and then compiling that C would
> >> be inefficient, complicated and produce a less efficient result (because
> >> the compiler cannot use its knowledge of the C++ syntax in order to better
> >> optimize the code), so it would make little sense.
>
> >>  (As an example, I'm guessing that exception handling is impossible to
> >> convert into C code so that it would be as efficient as when compiling
> >> C++ directly. C++ exceptions are designed so that if no exception is
> >> thrown, the code will be as efficient as if no exceptions were in use
> >> at all. I think this would be impossible to express in C.)
>
> >Would the same not apply with asm?
>
> Not really. Or rather there is no asm that couldn't be
> reverse-engineered back into an equivalent expression in another
> higher-level language.

hardly. Compiling is a pretty information lossy process. The chances
of recovering usable source from machine code is pretty slim.

> Thus while performing a C++ to C conversion at the source code level
> would likely lead to a complete mental collapse, a C++ to asm then asm
> to C would be doable - though definitely non-trivial.

I'm not convinced disassembly is easier than compiling C++ into C. We
know people can write C++ compilers there are loads around. C-Front
specifically compiled into C. Disassembly is a Hard problem.

[toc] | [prev] | [next] | [standalone]


#12168

From"Paul" <pchrist<nospam>or@yahoo.co.uk>
Date2011-12-08 13:42 +0000
Message-ID<jbqerp$2n4j$1@adenine.netfront.net>
In reply to#12161
"Nick Keighley" <nick_keighley_nospam@hotmail.com> wrote in message 
news:39385b47-31ee-4e0c-ac37-368b5291d354@m10g2000vbc.googlegroups.com...
On Dec 7, 6:28 pm, ralph <nt_consultin...@yahoo.net> wrote:
> On Wed, 7 Dec 2011 17:37:14 -0000, "Paul"
> <pchrist<nospam>o...@yahoo.co.uk> wrote:
>
> >"Juha Nieminen" <nos...@thanks.invalid> wrote in message
> >news:4edf181e$0$2821$7b1e8fa0@news.nbl.fi...
> >> Leigh Johnston <le...@i42.co.uk> wrote:
> >>> On 06/12/2011 16:49, Sheky wrote:


> >>>> Could anyone please answer if every C++ programs get converted to
> >>>> equivalent C code during compilation ? Thank you.

no. Not all C++ compilers use C as an intermediate language. I
understand very few do. It's slow and (I understand- IANA compiler
writer) C isn't a particularly good intermediate language.

> >>> Some early C++ compilers worked this way but I suspect very few modern
> >>> C++ compilers produce C as an intermediate but rather create machine
> >>> code directly.
>
> >> Actually compilers, especially those supporting many languages (such as
> >> gcc) probably produce a kind of "intermediate" form (which is more or 
> >> less
> >> common to all the languages that the compiler supports), which is then
> >> optimized and compiled into asm.

or directly into machine code.
---------------------------------------------------

Compilers to not output machine code or asm , a compilers output is object 
code.

Is this an other idiot thats gonna try and argue that machine code is object 
code ?



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#12169

FromRui Maciel <rui.maciel@gmail.com>
Date2011-12-08 13:56 +0000
Message-ID<jbqfn2$lao$1@speranza.aioe.org>
In reply to#12168
 wrote:

> Compilers to not output machine code or asm , a compilers output is object
> code.

rui@Kubuntu:tmp$ cat main.c 
int main()
{
        return 0;
}

rui@Kubuntu:tmp$ gcc -S main.c -o main.s
rui@Kubuntu:tmp$ cat main.s
        .file   "main.c"
        .text
        .globl  main
        .type   main, @function
main:
.LFB0:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        movl    $0, %eax
        popq    %rbp
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE0:
        .size   main, .-main
        .ident  "GCC: (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1"
        .section        .note.GNU-stack,"",@progbits



> Is this an other idiot thats gonna try and argue that machine code is
> object code ?

What's your definition of machine code?  And what's your definition of 
object code?


Rui Maciel

[toc] | [prev] | [next] | [standalone]


Page 1 of 7  [1] 2 3 4 5 6 7  Next page →

Back to top | Article view | comp.lang.c++


csiph-web