tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] How to use char "\"


From: Evan Langlois
Subject: Re: [Tinycc-devel] How to use char "\"
Date: Tue, 30 Sep 2014 14:47:55 -0500

JFC,

I used TCC all the time to test little code snippets.  I write test cases as shell scripts in C, and use TCC's compile-on-the-fly feature.  I've not run into problems with it really, even when doing some pretty weird bit-level hackery.

On Tue, Sep 30, 2014 at 2:18 PM, JFC Morfin <address@hidden> wrote:
The question is not about bugs. These are ten years old libraries used millions of time but compiled under Borland. There are differences between compilers. The question is only to understand them.

Borland isn't known for its standards compliance.  My guess is that Borland wasn't handling the escape sequences properly and ignoring unknown ones or something.  The standard specifically states that its supposed to throw up a warning if it finds an unknown escape.  Now you have TCC and GCC and they are doing it right, and your having problems.  BTW, according to the standard, ? should be escaped as well.  So \*? becomes "\\*\?"

And off-topic, but you mentioned your code handled regex's.  Google has a lightning fast regex implementation.  Its missing back references or something, but the speed is pretty amazing.   I forget the name of the lib, but you can Google it.   Maybe I'll see if it compiles under TCC :)

Thx. 1. What I suspect is that TCC only reports a kind of compilation error at a time not all of them. For example when I tried to address the "\" issue, it did not report on "isascii". Is there a way to tell TCC to continue trying to compile even after "blocking" errors. This was by default in BCC and several others.

There shouldn't have been any problem with isascii().  Works fine for me.

2. Sometimes you can have the kind of report above not displayed on the screen but directly sent in a file (because it may be rather long). Just asking.

This is Unix.  We have tools for handling output like that and for processing it.  Windows doesn't.

Uhmm ... and what escape is \. supposed to be? You are confusing C escapes with regular expressions I think.
This depends on compilers. In other compiler or environnement you must escape more things. In BCC these escapes are required

Uhmm ... you seem awfully sure of that.  But there is such a thing as standards and following them will help.  Again, TCC isn't doing anything wrong.  You can find a list of the standard C escapes anywhere.  Wikipedia and my outdated ANSI C list show the same list and I know wikipedia is pretty current, so the standard hasn't likely changed much.

Sure. And isascii is documented there.

Tried a minimal test case?

Test your code with gcc please. If it compiles under gcc and then fails under tcc, then this is the proper list. If it won't compile under gcc, then perhaps stackoverflow would be a better place for help.
My choice of TCC is to avoid GCC :-) There are declaration discrepancies and they have used some function names I also used. If I could stay with tcc it would be simpler.

Perhaps you missed my point.  You can try the LLVM compiler to determine if your problems are your own or tcc's.  Your issues are all that your code is radically non-standard.  Yes, tcc has a number of short-comings, but it handles simple string escapes and generic functions like isascii() just fine.  Perhaps Borland doesn't.

Also, if you are attempting to make tcc your main compiler, then realize that tcc doesn't optimize nearly as well as GCC or LLVM.  But ... if you are going to embed a C compiler into another program to "script" it in C, or want to write shell scripts in C  with #!/usr/bin/tcc -run  then tcc is really awesome.  If avoiding gcc is your only reason for using tcc, you may be disappointed.

reply via email to

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