tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] How to optimize compiling sizeof const?


From: YX Hao
Subject: Re: [Tinycc-devel] How to optimize compiling sizeof const?
Date: Thu, 31 Jul 2014 19:25:38 +0800

Hi,

I mean just Ramsay Jones wrote.

> the expression:
> 
>     sizeof("a string literal")
> 
> was causing an _unused_ copy of the string literal to be stored in
> the data section. This expression is a compile-time constant and,
> once it has been evaluated, the string literal is no longer required
> (even at compile time).
-----------^^^^^^^-------- Here, may be you are right, I don't know that.

I think the string is useless to store into a compiled file.

I am not saying this:

Jared Maddox wrote:
> 
> void arg_size( void (*func)( const char* ) )
> {
>   if( func )
>   {
>     ( *func )( "sizeof" );
>   }
> }
> 

It's tricky. I am really not meaning this. :p
May be for the compiler, they all contenting a string.

Try my attached file to understand what I mean. Compile it to an object file or 
a executable file, and then open it with an editor, you can find two "AElig". 
And the 2nd is useless.


As I know very little about the compiler. I just present you the fact.
May be implement this "skip the useless string" could be hard, or need many 
codes. I am learning.

Regards,
YX Hao

Attachment: E.c
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]