Problem with tabs

Problem with tabs

Post by Rahul Agark » Thu, 17 Jan 2002 20:33:03



Hi gurus,

I am trying to compile following file with g++. I am using -E options
which says don't invoke the compiler. Stop at the preprocessor level.

The file is :
        Hello
There

Please note that the space before hello is not a space but it is a tab
character.

Now compile this file as

g++ -x c -E hello > hello.new

After the compilation is done, if you see the contents of hello.new
file, all the tab characters are changed to space characters (white
spaces).

I'm facing some problems due to this behavious. In my case, we
generate makefiles by compiling some other files this way. Then the
generated makefiles are actually used for the final build. Now the
problem is that the source files from which the makefile is generated
has some tab characters which get converted to white spaces. Now when
i run make utility on this makefile, the utility gives error as it is
not able to recognise the white spaces.

So, my question is that whether, i am missing some compiler flag or
something or there is some problem with the compiler itself. If there
is some problem with the compiler itself, is ther any patch which
fixes this problem?

Thanks and regards,
Rahul

 
 
 

Problem with tabs

Post by Rahul Agark » Fri, 18 Jan 2002 14:43:52


Mail from :

James D. McIninch
Cereon Genomics, LLC

The compiler has no problem. It's properly invoking the C
preprocessor which is correctly emitting the results of the
preprocessor. It just so happens that converting leading tabs
to spaces is the correct and expected behavior.

It wouldn't be approriate to use the C preprocessor to try
and preprocess files that don't have ANSI C semantics. There
are other tools for doing such things (php, m4, autoconf, etc).


> Hi gurus,

> I am trying to compile following file with g++. I am using -E options
> which says don't invoke the compiler. Stop at the preprocessor level.

> The file is :
>         Hello
> There

> Please note that the space before hello is not a space but it is a tab
> character.

> Now compile this file as

> g++ -x c -E hello > hello.new

> After the compilation is done, if you see the contents of hello.new
> file, all the tab characters are changed to space characters (white
> spaces).

> I'm facing some problems due to this behavious. In my case, we
> generate makefiles by compiling some other files this way. Then the
> generated makefiles are actually used for the final build. Now the
> problem is that the source files from which the makefile is generated
> has some tab characters which get converted to white spaces. Now when
> i run make utility on this makefile, the utility gives error as it is
> not able to recognise the white spaces.

> So, my question is that whether, i am missing some compiler flag or
> something or there is some problem with the compiler itself. If there
> is some problem with the compiler itself, is ther any patch which
> fixes this problem?

> Thanks and regards,
> Rahul


 
 
 

1. Problem with tabs in rxvt

I'm having trouble with displaying tabs in rxvt.

If I cat or more a file that contains tabs, the tab character will force
the cursor to the end of the line. This only seems to happen in rxvt,
since it seems to work fine in xterm and the regular linux console.

Does anyone have any idea what might be wrong?

I'm using RedHat 6.1 and rxvt 2.6.1.

-John

2. content management system

3. Problems with TAB in Jed 0.96

4. konsole bidi bug/feature

5. Script GURUs - a tab is a tab is a tab

6. How to get the accounting information from a NAS

7. entering tab in vi without using tab key

8. practical minimum disk size?

9. replacing tabs with emulated tabs

10. tab versus tab

11. ALT-TAB bug (ALT-TAB on empty desktop, KDE1.1.2)

12. mysifying Alt+Tab problem

13. tcsh and problems with AUTOLIST via the tab key