I need a small (not bloated to hell, clean, not system ruining / service installing) compiler for tiny C programs with POSIX-like semantics (i.e. C library that doesn't suck and stuff like read() instead of ReadFileWEX(WHANDLE, WSHARINGMODE, WSECURITYCONTEXT, NULL, NULL, NULL, NULL) - true POSIX stuff like fork() et al is not needed).
Visual Studio or cygwin are out of the question. Some GCC distro like mingw might be OK depending on how much the installation sucks (ideally there wouldn't be any installation at all).
Any ideas or do I give up to ENTERPRISE-quality software?
If you're fine with C89 syntax, MSVC is decent. Mingw otherwise.
Name:
Anonymous2009-08-12 14:59
tcc
Name:
Anonymous2009-08-12 15:18
Sounds to me like you already know what you want. Why are you even asking this question?
MinGW doesn't need installation. You can copy the directory and take it in a flash drive to use it anywhere.
TCC but it has some limitations(very fast, has built-in interpreter,result code quality is poor(but can be somewhat optimized)).
GCC on mingw(compilation speed varies,huge codebase,optimized code, alot of libraries depend on it).
Also try Pelles C (<-ENTERPRISE QUALITY windows bindings) and Digital Mars C compiler(If you need code better then TCC but dislike GCC).
TTC links to mscvrt.dll and has all their functions(even if you omit include files,though without defines like FILE* struct) exported by default:
e.g. this is valid TCC code
main(){printf("123");}
>>6
1.mingw GCC port is outdated.
2.Huge size and its a slowpoke.
3.Has numerous bugs.
_______________________ http://xs135.xs.to/xs135/09042/av922.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
The world breaks everyone and afterward many are strong in the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.
>>7 All pages in my firefox set to render in Verdana, your <code> has no effect.
______________________________________ http://xs135.xs.to/xs135/09042/av922.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
There are two kinds of scientific progress: the methodical experimentation and categorization which gradually extend the boundaries of knowledge, and the revolutionary leap of genius which redefines and transcends those boundaries. Acknowledging our debt to the former, we yearn, nonetheless, for the latter.
>>6
GCC is a piece of shit. Even most OSS projects hate it. Some big examples from the top of my head:
* ffmpeg's libavcodec H.264 decoder, despite all the assembly and GCC-catering optimizations, gets a 10% performance boost just by compiling it with ICC. ffmpeg, like a lot of other projects, has numerous workarounds for GCC bugs (code that refuses to compile depending on optimization settings, inline assembly that GCC can't manage to allocate input registers for...). The speed of the library has been regressing with basically every new GCC release, with 2.9.5 being the fastest and early 4s being the slowest (I hear that newer 4s do a bit better though)
* All of Mozilla's big projects (such as Firefox and Thunderbird) are compiled using MSVC on Windows, even though they can be compiled using GCC. Even before the builds started using PGO, GCC generated significantly worse code. Now PGO exacerbates this even more.
Also, let me remind you that MSVC does in fact support plenty of architectures. For example, Itanium, Alpha, and some PPC (the XBox360 at least) are supported. Moreover, its code generation hasn't really improved since the 6.0 release (which is over a decade old now), making GCC's suckuness even more embarrassing.
tl;dr: GCC is fine as long as you don't care at all about bloat, speed and codegen quality
>>16
x264 uses mingw because they don't want to support MSVC (it was three lines of code last time I saw it but they really hate it). Not they it matters since most time is spent in hand-crafted asm and it's written in a "spoonfed" style that makes generating bad code really difficult (that said, GCC does manage it, and there's some asm that should be unnecessary and is only there to workaround GCC's shit code generation, basically compiled asm dumps with GCC's retarded stuff fixed manually on top).
>>17
Compiling for Windows is a different story. What GCCs are available for Windows? MinGW and Cygwin (and DJGPP, but I haven't actually tried that one). MinGW is a piece of bug-ridden shit, and it wouldn't surprise me if they didn't use Cygwin because of a licensing issue.
If it's so bug-ridden why don't you try fix it, oh yeah, forgot you can only use software and not write software, keep your bullshit to yourself monkey.
gcc bugs are more visible than bugs in other compilers simply because so many more people use gcc, and gcc is open source. They also tend to get fixed.
All of this gcc whining is entertaining, but it's a very solid C compiler, particularly when compared to most of the alternatives.
The truth about GCC is that it is a monster of a system. This system is decades old. It has to account for a massive number of different quirks for the different standards, different languages and different architectures. The age of the system together with it's massive scope leads to results that may not be optimal as compared to more focused compilers.
This is why I believe it's not easy to compare GCC with other compilers as the other compilers target a much smaller scope.
This thread has been truly insightful. Now I wouldn't feel so bad about writing my own compiler and code generator. Thank you /prog/!
Name:
Anonymous2009-08-14 14:21
Holy shit tcc is so unbelievably fast. Truly a God-tier compiler, for less size than it takes GCC to print its own version (or for MSVC's setup to show the EULA). I'm moving everything to tcc.
>>35
Enjoy not being able to compile real languages like Fortran 95
Name:
Anonymous2009-08-14 14:28
>>35 NOTE: TCC is still somewhat experimental and is not recommended for production use. The code it generates is much less optimized than what GCC produces, and compiler bugs can have serious security consequences for your program.
It's useful if compiler size is and sometimes -O0 compiler speed is what you're after, but how often is that?
>>37
tcc's "-O0 compiler speed" is 10 times faster than GCC's. That's totally unjustifiable for GCC, all thing considered. Twice as fast or so I'd understand, but an order of magnitude faster just means GCC sucks aplenty.
>>41
Introduction
TCCBOOT is a boot loader able to compile and boot a Linux kernel directly from its source code.
TCCBOOT is only 138 KB big (uncompressed code) and it can compile and run a typical Linux kernel in less than 15 seconds on a 2.4 GHz Pentium 4.
TCCBOOT is based on the TinyCC compiler, assembler and linker. TinyCC is an experiment to produce a very small and simple C compiler compatible with the GNU C compiler and binary utilities.
___________________________________ http://xs135.xs.to/xs135/09042/av922.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
The knowable world is incomplete if seen from any one point of view, incoherent if seen from all points of view at once, and empty if seen from nowhere in particular.
Name:
Anonymous2009-08-14 15:58
>>40
They did that because Pascal doesn't have enough features. I don't understand this, because that's why pascal is good, but whatever.
Name:
Anonymous2009-08-14 16:31
>>44
Pascal was an interpreted language at the time, so the real question is why the fuck they wrote it in Pascal to begin with.
Name:
Anonymous2009-08-14 16:52
>>45
I'm pretty sure Pastel was compiled, dude. Stallman originally wrote it in Pastel because he was just extending an existing (Pastel) compiler rather than writing his own from scratch.
Name:
Anonymous2009-08-14 17:22
>>46
Traditionally Pascal was compiled into P-code and run with a P-code interpreter.
>>47
There were a lot of Pascal dialects that weren't compiled to p-code, and Pastel was one of them.
Name:
Anonymous2009-08-14 18:17
>>15
I lol'd. By the way - goddamnit, fucking Spinoza.
Name:
Anonymous2009-08-15 5:16
The original aim of the TCC is to create a simple and small compiler to compile GCC.
Now here's a riddle: Can you guess why?
Name:
Anonymous2009-08-15 5:27
>>52
The requirements for a C compiler to compile GCC are far smaller than using GCC, a complete compiler that intends to target everything under the sun.
TCC is so small it can be audited after assembly. The TCCBOOT script is also relevant. The answer is that it's meant to provide a way for creating a secure tool-chain. See work by Ken Thompson.
Name:
Anonymous2009-08-15 6:56
>>55
Although after compiling gcc with tcc, you should then compile gcc with the tcc-compiled gcc, since tcc's output is SHIT in terms of efficiency (very simple first-use limited-scope register allocation only for temporaries, everything kept on stack, etc.)
>>56 You should check Digital Mars C and PellesC which optimize code much more.
I use TCC as described in >>38
________________________________________ http://xs135.xs.to/xs135/09042/av922.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
If I want to understand something, I must observe, I must not criticize, I must not condemn, I must not pursue it as pleasure or avoid it as non-pleasure. There must merely be the silent observation of a fact.
>>58
i can't stop lolling.
YOU are interested in code optimization? hahahahaha.
bullshit. you write the most inefficient code i've ever seen.
for example, i've seen you write something very similar to this: for(; i < (strlen(str1) > strlen(str2)? strlen(str2): strlen(str1)); ++i)
str1[i] == str2[i];
your code is truly laughable, and this little snippet is just the tip of the iceberg.
what makes it even funnier is that you're completely dokyun
>>60
You do realize that because of this he stands to gain the most out of nearly any programmer from optimization right? Will an optimizing compiler move strlen calls outside the loop invariant? Yes. Will it memoize the strlen calls, or even just the comparison result? Yes. That is of course, if it can determine the loop body doesn't change the result of the strlen calls, and I would put money on that being the case for any non-shit compiler (assuming the == was meant to be =).
>>62
I have personally tested this optimization on gcc in the past. If you are invoking the standard strlen function, gcc knows beforehand that it is pure. Figuring out that the null terminator in str1 will never get overwritten then should be trivial.
>>61
no.
how does the compiler know that the functions don't increment a static variable or somesuch and need to be called every iteration?
it doesn't. compilers are not magic
Name:
Anonymous2009-08-15 22:02
Just download the window SDK. It's almost a fucking xcopy for an install.. It supports POSIX api's (like just about every version from NT4). And it builds Win32 code as you are, for some reason, asking for.
Oh.. and Posix is _Open, OpenFile(..) is Win16 and CreateFile(..) is Win32. The difference is about 2 parameters and CreateFile gives you a useful Win32 handle.
Learn about what you're writing before you actually start (facepalm).
Name:
Anonymous2009-08-15 22:07
>>63
It can know that strlen is pure and use that for some optimisations, but it won't step through your code to the extent required to turn the code in >>60 into non-sucking code. Rather than being ``trivial'', the sort of optimisations you have in mind are equivalent to solving the halting problem.
If it did do something like that for you, chances are you were in one of the rare situations were a C string was actually immutable (and I don't mean const char*). That's not the case in >>60.
Name:
Anonymous2009-08-15 22:40
>>66
You completely misunderstand both the halting problem and this one. The difference here is that the compiler has a higher order view of the inner workings of whatever you give it. It does not have some magical black box and has to return 1 or 0 based on whether the black box halts on given input or not. It can analyze inside the black box and determine for itself.
compiler: is strlen pure? yes
compiler: will str1[i] = str2[i] ever change the invariant?
compiler: will "i" ever exceed the length of str1?
compiler: no, the invariant is bounded above by strlen(str1)
compiler: therefore str1[i] = str2[i] will never overwrite the null terminator
compiler: therefore neither strlen changes
compiler: the loop invariant must never change
compiler: i can optimize this out
>>67
What happens when str1 or str2 are in shared memory?
The point isn't even that you can tailor-make a compiler to deal with a specific piece of shared code; that's plainly obvious and completely irrelevant.
>>66 It can know that strlen is pure and use that for some optimisations
Yanno, I wish C was better about letting you write explicitly pure functions (and forcing them to actually be pure). I heard Ada does this with the function vs. procedure keywords, and if you use the former you can't modify anything outside of local scope.
Name:
Anonymous2009-08-15 23:22
>>68
It doesn't matter if they are in shared memory, the compiler has already determined no null terminator will get written so it doesn't really change anything, it's hardly tailor made.
>>70
If your ``optimization'' changes what an algorithm actually does, it's not an optimization. Nor is it something any compilers will actually do.
Name:
Anonymous2009-08-15 23:49
>>70
What? What if you put a null-terminator before the current one?
Name:
Anonymous2009-08-16 0:48
nomatter what strlen optimisations are offered by the compiler, there is still the plain fact that the code could easily be written without calls to strlen.
allow me to demonstrate. something like this would be much more efficient: while(*str1 && *str2)
*str1++ = *str2++;
>>78
Well, obviously I forgot the ++, didn't I? Don't be dense.
>>79
It's odd that the parser can't make sense of that, since there's really only one way to parse that so that you end up with an assignment to an lvalue.
>>90 Turns out that dokyun means “idiot”. Not just a foolish person, as the translations I’ve looked at claim, but someone so stupid that, when he does something stupid, he actually thinks he’s doing something clever.
here's the most important part.
Why the need for acronyms that obscure their meaning? You only alienate your readers.
_________________________________________ http://bayimg.com/image/aadbjaace.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
On a given day, a given circumstance, you think you have a limit. And you then go for this limit and you touch this limit, and you think, 'Okay, this is the limit.' As soon as you touch this limit, something happens and you suddenly can go a little bit further.
>>91 That is called being stubborn. I can change my positions if presented with a convincing argument.
For example, if one proves me that indentation of code gives me some tangible benefit i'll start indenting my code.
Indentation for example, makes code writing slower, and wastes screen real estate.
The argument for indentation has to counteract these qualities and present a tangible benefit above them.
________________________________________ http://bayimg.com/image/aadbjaace.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
The philosopher is Nature's pilot. And there you have our difference: to be in hell is to drift: to be in heaven is to steer.
>>93
no, it's not called being stubborn, it's called being an idiot.
DQN is thinking you're really smart while doing stupid things that make everybody facepalm or laugh at you.
stubbornness is unwillingness to change, DQN is pure unbridled stupidity and arrogance.
>>96
no, DQN does not consider himself an idiot.
nor do you.
lots of idiots think they're idiots, but lots of idiots also think they're smart. quit trying to change the subject and avoid the point with meaningless babble.
Name:
Anonymous2009-08-16 5:59
>>60-81
You guys heard about something called a "standard library"?
>>99
no no no no no.
a stubborn person knows they are an idiot, but refuses to yield to the truth.
DQN thinks they're smart and doesn't believe for a second that they're stupid.
fuck, did you even read the page?
if you don't understand it by now then i give up.
i will not breastfeed you answers any longer
>>101 a stubborn person knows they are an idiot, but refuses to yield to the truth.
Sounds absurd and near-religious.
If the person is stubborn they obviously do not consider themself an idiot.
Refusing to "yield to truth" isn't a crime, "truth" is often subject to bias and cultural background.
________________________________________ http://bayimg.com/image/aadbjaace.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
The crucial and monumental development in the art music of our century has been the qualitative change in the foundational premises of our musical language--the change from a highly chromaticized tonality whose principle functions and operations are still based on a limited selection, the seven notes of the diatonic scale, from the universal set of twelve pitch classes to a scale that comprehends the total pitch-class content of that universal set. We can point to the moment of that change with some precision. It occurs most obviously in the music of Scriabin and the Vienna circle, Schoenberg, Webern, and Berg, in 1909-1910, and very soon afterwards, though less obviously, in the music of Bartok and Stravinsky. I think it is safe to say that nothing of comparable signifigance for music has ever occurred, because the closing of the circle of fifths gives us a symmetrical collection of all twelve pitch classes that eliminates the special structural function of the perfect fifth itself, which has been the basis of every real musical system that we have hitherto known.
>>82
No, the precedence rules themselves are odd to the point where they can be considered broken. It's not the only place in the C standard where that's the case.