* What is translation unit
@ 2007-12-10 10:37 mahmoodn
2007-12-10 12:26 ` John Love-Jensen
0 siblings, 1 reply; 6+ messages in thread
From: mahmoodn @ 2007-12-10 10:37 UTC (permalink / raw)
To: gcc-help
Hi,
What is translation unit and how can I determine how many translation unit
my code have? :confused:
Thanks
--
View this message in context: http://www.nabble.com/What-is-translation-unit-tp14250608p14250608.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What is translation unit
2007-12-10 10:37 What is translation unit mahmoodn
@ 2007-12-10 12:26 ` John Love-Jensen
2007-12-10 12:43 ` mahmoodn
0 siblings, 1 reply; 6+ messages in thread
From: John Love-Jensen @ 2007-12-10 12:26 UTC (permalink / raw)
To: mahmoodn, MSX to GCC
Hi mahmoodn,
> What is translation unit and how can I determine how many translation unit
> my code have? :confused:
Let's say you have three source code files, foo.cpp, bar.cpp and baz.cpp.
Here are the three translation units, which translate from the source file
to the object file.
g++ -c foo.cpp -o foo.o
g++ -c bar.cpp -o bar.o
g++ -c baz.cpp -o baz.o
When linking the object files together, that process is not a translation
unit.
g++ foo.o bar.o baz.o -o quux
HTH,
--Eljay
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What is translation unit
2007-12-10 12:26 ` John Love-Jensen
@ 2007-12-10 12:43 ` mahmoodn
2007-12-10 13:32 ` John Love-Jensen
0 siblings, 1 reply; 6+ messages in thread
From: mahmoodn @ 2007-12-10 12:43 UTC (permalink / raw)
To: gcc-help
Hello,
Sorry, I did not fully understand. I think mean that number of translation
units = number of cpp files.
Right?
John (Eljay) Love-Jensen wrote:
>
> Hi mahmoodn,
>
>> What is translation unit and how can I determine how many translation
>> unit
>> my code have? :confused:
>
> Let's say you have three source code files, foo.cpp, bar.cpp and baz.cpp.
>
> Here are the three translation units, which translate from the source file
> to the object file.
>
> g++ -c foo.cpp -o foo.o
> g++ -c bar.cpp -o bar.o
> g++ -c baz.cpp -o baz.o
>
>
> When linking the object files together, that process is not a translation
> unit.
>
> g++ foo.o bar.o baz.o -o quux
>
> HTH,
> --Eljay
>
>
>
--
View this message in context: http://www.nabble.com/What-is-translation-unit-tp14250608p14252082.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What is translation unit
2007-12-10 12:43 ` mahmoodn
@ 2007-12-10 13:32 ` John Love-Jensen
2007-12-10 16:58 ` Robert Kiesling
0 siblings, 1 reply; 6+ messages in thread
From: John Love-Jensen @ 2007-12-10 13:32 UTC (permalink / raw)
To: mahmoodn, MSX to GCC
Hi mahmoodn,
> Sorry, I did not fully understand. I think mean that number of translation
> units = number of cpp files.
> Right?
More-or-less.
If a Fred.cpp does a #include "Barney.cpp", then Barney.cpp will be in the
same translation unit as Fred.cpp.
If Wilma.cpp is not compiled, then there is no Wilma translation unit.
Sincerely,
--Eljay
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What is translation unit
2007-12-10 13:32 ` John Love-Jensen
@ 2007-12-10 16:58 ` Robert Kiesling
2007-12-11 8:09 ` mahmoodn
0 siblings, 1 reply; 6+ messages in thread
From: Robert Kiesling @ 2007-12-10 16:58 UTC (permalink / raw)
To: gcc-help
Dear confused,
> > Sorry, I did not fully understand. I think mean that number of translation
> > units = number of cpp files.
> > Right?
>
> More-or-less.
>
> If a Fred.cpp does a #include "Barney.cpp", then Barney.cpp will be in the
> same translation unit as Fred.cpp.
>
> If Wilma.cpp is not compiled, then there is no Wilma translation unit.
>
> Sincerely,
> --Eljay
>
IIRC correctly, a translation unit is the input that goes through
the preprocess-parse-codegeneration cycle.
That means all of the cpp inputs of
g++ foo.cpp bar.cpp baz.cpp -o foobarbaz.o
are translation units.
Regards,
Robert
--
Ctalk Home Page: http://www.ctalklang.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: What is translation unit
2007-12-10 16:58 ` Robert Kiesling
@ 2007-12-11 8:09 ` mahmoodn
0 siblings, 0 replies; 6+ messages in thread
From: mahmoodn @ 2007-12-11 8:09 UTC (permalink / raw)
To: gcc-help
Thanks,
I understood...
Robert Kiesling wrote:
>
> Dear confused,
>
>> > Sorry, I did not fully understand. I think mean that number of
>> translation
>> > units = number of cpp files.
>> > Right?
>>
>> More-or-less.
>>
>> If a Fred.cpp does a #include "Barney.cpp", then Barney.cpp will be in
>> the
>> same translation unit as Fred.cpp.
>>
>> If Wilma.cpp is not compiled, then there is no Wilma translation unit.
>>
>> Sincerely,
>> --Eljay
>>
>
> IIRC correctly, a translation unit is the input that goes through
> the preprocess-parse-codegeneration cycle.
>
> That means all of the cpp inputs of
>
> g++ foo.cpp bar.cpp baz.cpp -o foobarbaz.o
>
> are translation units.
>
> Regards,
>
> Robert
>
> --
> Ctalk Home Page: http://www.ctalklang.org/
>
>
>
--
View this message in context: http://www.nabble.com/What-is-translation-unit-tp14250608p14269483.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-12-11 8:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-10 10:37 What is translation unit mahmoodn
2007-12-10 12:26 ` John Love-Jensen
2007-12-10 12:43 ` mahmoodn
2007-12-10 13:32 ` John Love-Jensen
2007-12-10 16:58 ` Robert Kiesling
2007-12-11 8:09 ` mahmoodn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).