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


Groups > comp.lang.java.programmer > #35689 > unrolled thread

Re: Forward references

Started byMartin Gregorie <martin@address-in-sig.invalid>
First post2016-10-02 17:11 +0000
Last post2016-10-02 19:56 -0400
Articles 6 — 3 participants

Back to article view | Back to comp.lang.java.programmer

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Forward references Martin Gregorie <martin@address-in-sig.invalid> - 2016-10-02 17:11 +0000
    Re: Forward references Jerry Stuckle <jstucklex@attglobal.net> - 2016-10-02 17:44 -0400
      Re: Forward references Martin Gregorie <martin@address-in-sig.invalid> - 2016-10-02 22:37 +0000
        Re: Forward references Jerry Stuckle <jstucklex@attglobal.net> - 2016-10-02 22:01 -0400
      Re: Forward references Arne Vajhøj <arne@vajhoej.dk> - 2016-10-02 19:54 -0400
    Re: Forward references Arne Vajhøj <arne@vajhoej.dk> - 2016-10-02 19:56 -0400

#35689 — Re: Forward references

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2016-10-02 17:11 +0000
SubjectRe: Forward references
Message-ID<nsrf3t$mti$1@dont-email.me>
On Sun, 02 Oct 2016 15:45:19 +0000, Stefan Ram wrote:

> An old C compiler from the 70s is a one-pass compiler IIRC,
>   so it does not do "forward references".
>
Whose C was that? 

Not K&R for sure: they've always had separate preprocessor, C->Assembler 
translation, assembler and linker phases. Thats a given, since from the 
outset they were designed to use the native assembler and linker
of the target machine, since that's an easy way to make porting easier.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [next] | [standalone]


#35691

FromJerry Stuckle <jstucklex@attglobal.net>
Date2016-10-02 17:44 -0400
Message-ID<nsrv41$io0$1@jstuckle.eternal-september.org>
In reply to#35689
On 10/2/2016 1:11 PM, Martin Gregorie wrote:
> On Sun, 02 Oct 2016 15:45:19 +0000, Stefan Ram wrote:
> 
>> An old C compiler from the 70s is a one-pass compiler IIRC,
>>   so it does not do "forward references".
>>
> Whose C was that? 
> 
> Not K&R for sure: they've always had separate preprocessor, C->Assembler 
> translation, assembler and linker phases. Thats a given, since from the 
> outset they were designed to use the native assembler and linker
> of the target machine, since that's an easy way to make porting easier.
> 
> 

Stefan is correct.  The preprocessor is not a compiler; neither is the
linker.  And there was not a c->Assembler and assembler - every C
compiler I know of (at least since the mid 80's) generated machine code
directly, although most did have the option to output the assembler
code, also.   There was not a separate assembler step.

And yes, the compiler is a one-pass compiler.  It does not allow forward
references.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

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


#35692

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2016-10-02 22:37 +0000
Message-ID<nss26d$r4e$1@dont-email.me>
In reply to#35691
On Sun, 02 Oct 2016 17:44:45 -0400, Jerry Stuckle wrote:

> Stefan is correct.  The preprocessor is not a compiler; neither is the
> linker.  And there was not a c->Assembler and assembler - every C
> compiler I know of (at least since the mid 80's) generated machine code
> directly, although most did have the option to output the assembler
> code, also.   There was not a separate assembler step.
>
There is in all K&R and gnu C compilers I've used. Its not normally 
visible because 'cc' or 'gcc' is a micro-OS that runs the compilation 
modules (pre, c translator, ...) as required by the supplied arguments 
and options. Thus it *looks* like a single step, but really isn't. 

Some of the other compilers, e.g. Borland, may differ.

> And yes, the compiler is a one-pass compiler.  It does not allow forward
> references.
>
So shoot me. Been writing too much Java recently. Hopefully back to 
rather more C this winter. 


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

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


#35697

FromJerry Stuckle <jstucklex@attglobal.net>
Date2016-10-02 22:01 -0400
Message-ID<nsse5s$i8u$1@jstuckle.eternal-september.org>
In reply to#35692
On 10/2/2016 6:37 PM, Martin Gregorie wrote:
> On Sun, 02 Oct 2016 17:44:45 -0400, Jerry Stuckle wrote:
> 
>> Stefan is correct.  The preprocessor is not a compiler; neither is the
>> linker.  And there was not a c->Assembler and assembler - every C
>> compiler I know of (at least since the mid 80's) generated machine code
>> directly, although most did have the option to output the assembler
>> code, also.   There was not a separate assembler step.
>>
> There is in all K&R and gnu C compilers I've used. Its not normally 
> visible because 'cc' or 'gcc' is a micro-OS that runs the compilation 
> modules (pre, c translator, ...) as required by the supplied arguments 
> and options. Thus it *looks* like a single step, but really isn't. 
> 

There have been in none of the ones I've used, since 1985 or so.  The
compiler goes directly to machine language; it does not generate
assembler and then assemble the resultant code.

Many compilers have an option to generate assembler code instead of
machine code.  But that does not mean there are two separate steps.

> Some of the other compilers, e.g. Borland, may differ.
> 
>> And yes, the compiler is a one-pass compiler.  It does not allow forward
>> references.
>>
> So shoot me. Been writing too much Java recently. Hopefully back to 
> rather more C this winter. 
> 
> 

So don't tell him he's wrong when you don't know what you're talking about.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

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


#35693

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-10-02 19:54 -0400
Message-ID<nss6of$bhc$1@gioia.aioe.org>
In reply to#35691
On 10/2/2016 5:44 PM, Jerry Stuckle wrote:
> On 10/2/2016 1:11 PM, Martin Gregorie wrote:
>> On Sun, 02 Oct 2016 15:45:19 +0000, Stefan Ram wrote:
>>> An old C compiler from the 70s is a one-pass compiler IIRC,
>>>   so it does not do "forward references".
>>>
>> Whose C was that?
>>
>> Not K&R for sure: they've always had separate preprocessor, C->Assembler
>> translation, assembler and linker phases. Thats a given, since from the
>> outset they were designed to use the native assembler and linker
>> of the target machine, since that's an easy way to make porting easier.
>
> Stefan is correct.  The preprocessor is not a compiler; neither is the
> linker.

True.

>         And there was not a c->Assembler and assembler - every C
> compiler I know of (at least since the mid 80's) generated machine code
> directly, although most did have the option to output the assembler
> code, also.   There was not a separate assembler step.

GCC

It has 'gcc' call 'cc1' to generate '.s' and call 'as' to assemble to '.o'.

But the assembler is not a compiler pass either.

Arne

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


#35694

FromArne Vajhøj <arne@vajhoej.dk>
Date2016-10-02 19:56 -0400
Message-ID<nss6rs$bhc$2@gioia.aioe.org>
In reply to#35689
On 10/2/2016 1:11 PM, Martin Gregorie wrote:
> On Sun, 02 Oct 2016 15:45:19 +0000, Stefan Ram wrote:
>
>> An old C compiler from the 70s is a one-pass compiler IIRC,
>>   so it does not do "forward references".
>>
> Whose C was that?
>
> Not K&R for sure: they've always had separate preprocessor, C->Assembler
> translation, assembler and linker phases. Thats a given, since from the
> outset they were designed to use the native assembler and linker
> of the target machine, since that's an easy way to make porting easier.

The one vs multi pass is only about what happens in 'cc1' when
compiling '.i' to '.s'.

Arne

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web