but it's probably going to be a long time before there are any c1x compilers... just look at how long it took for c99. and last time i checked (about 3 months ago) i could only find 2, both closed-source, and one of them costs money.
>>40
It's like MS decided to just add byte counts to every single char* parameter, ignoring the fact that many of the existing functions ALREADY have one.
Name:
Anonymous2009-11-11 7:46
>>31
This is why they need to add to the standard library. Instead of adding complex numbers and shit like that.
>>58
A non-free C compiler? wtf is it called and does anybody bother?
One of the distinguishing characteristics of Go is its unusual type system. It eschews some typical object-oriented programming concepts such as inheritance. You can define struct types and then create methods for operating on them. You can also define interfaces, much like you can in Java. In Go, however, you don't manually specify which interface a class implements. Pike explained to me that the interface mechanism gives developers some of the flexibility of duck-typing, but it goes further by providing the advantages of compile-time checking.
One day earlier...
>>6 Kind of. I'd be perfectly happy with classes but no inheritance whatsoever. Or maybe completely statically resolved inheritance only.
>>52
That's still bullshit and you know it. Unicode is a huge pain to support in See/Sepples. You have to do a bunch of macro hacks and the like or just plain have an unmaintainable amount of mixing within the code.
Real support for UNICODE would be nice. Something like #define UNICODE 0, 8, 16, 32 or whatever.
>>52 My #1 wish for C1X is support for UTF-16 string literals. And guess what? I got my wish. (I read the C1X draft... u"some string" is UTF-16, U"some string" is UTF-32. sweet.)
Fucking ew. Didn't we already have L""? What was so wrong with that?
Name:
Anonymous2009-11-11 12:22
A non-free C compiler? wtf is it called and does anybody bother?
well, there's sun studio, which is free as in beer, but closed source: http://developers.sun.com/sunstudio/documentation/ss12u1/mr/READMEs/c.html This compiler is in full compliance with ISO/IEC 9899:1999, Programming Language - C and is available on Solaris platforms when you compile with the -xc99 option. This compiler supports all C language features of ISO/IEC 9899:1999, Programming Language - C on all supported operating systems.
and then there's this thing: http://www.edg.com/index.php?location=c_lang The front end accepts the C++ language as defined by the ISO/IEC 14882:2003 standard. It also accepts the C language as defined by the ISO/IEC 9899:1990 ("C89") and ISO/IEC 9899:1999 ("C99") standards and the "Embedded C" extensions of ISO/IEC TR 18037. http://www.edg.com/index.php?location=faq_q2_cost So how much do you charge for a single copy for Windows?
Sorry, we don't sell end-user products. We only license source code, which probably costs more than you're looking to spend if all you need is a single end-user copy.
How much does a source code license cost?
Usually somewhere between $40,000 and $250,000. There are lots of different kinds of licenses, so you'll have to contact us to get a specific quote.
Name:
Anonymous2009-11-11 13:22
>>67
Why would someone want to pay for the EDG thing? Is there something wrong with using GCC for commercial products?
Name:
EFF2009-11-11 13:34
>>68 using GCC for commercial products
*grabs dick*
>>68
Probably why there's many other commercial implementations for various languages: support, bug fixes, payed feature requests, strict compliance with standards, better code quality than gcc...
>>71
I do know x86 asm pretty well, and I hate looking at gcc's code. >>72
You could say GCC has the most supported platforms and average code quality through-out, but on most popular platforms you tend to find better compilers for them.
>>74
You're probably right if you phrase it that way, since x86 asm gets extended so much every few years, and is quite a big mess overall, but my point was that I've been using it for many years and I may not know SSSE3 instructions that well, or know the ins and outs of VT-x, but you don't need those for general purpose x86 asm coding, and it's not hard to look them up in the Intel manuals when you need to use them.
>>76
On platforms where it works well, it's just about average, things I personally dislike are: sometimes it generates fairly bloated code, other times it makes optimizations which are unnecessary and make the code both slower and harder to read(for someone that wants obfuscated code, that might not be such a bad idea after all), while some other compilers generate both fast and straightforward code. However, there's much worse compilers than GCC, so for all intents and purposes, GCC is the most universal compiler out there, since it supports just about everything, but you should always look for alternatives if your platform is one with other compilers.
>>82
Don't be silly, you can examine the code generated by most commercial compilers like Intel's C compiler or Microsoft's C compiler, just as well as you can examine the code generated by GCC.
Name:
Anonymous2009-11-11 16:40
>>82
Intel is a CPU manufacturer.
If they wanted to fuck with you, they could just "plant the backdoors" right on the chip.
Damn opensores weenies and their baseless FUD.
>>84
It's also trivial to reverse engineer compiled code, especially one that you compile yourself. Not only that, but you can have the compiler generate symbols, and assembly listings which you can examine. More likely things to happen are trojans which modify base libraries and you end up with trojaned binaries - there was a recent case of that, someone made a virus which infected Delphi system libraries.
>>86
Why wouldn't they? It's fucking awesome. It's like .NET, but without imposing the heinous runtime requirements on the poor souls that try to use your software.
Name:
Anonymous2009-11-11 17:32
>>89
Awesome? Granted, it's been a long time since I used Delphi, but I don't remember it being awesome.
Name:
Anonymous2009-11-11 17:34
>>89
I don't know about Delphi now, but about 2 years ago I saw a Hello World written in it that compiled to a 300 kilobyte binary.
Name:
Anonymous2009-11-11 18:15
>>91
And I thought it was retarded that an equivalent "Hello world" is 15 kb with gcc (MinGW). (Although you can take it down to 5 kb with the -s flag. But that's still excessive to print "hello world")
>>91
I don't use Delphi myself, but I've had some experience with it in the past. You only get such huge binaries if you statically link various libraries in with your application. If you use only what is strictly necessary, you will only get a few KB overhead. It's no different from statically linking libc costs about 60kb, statically linking MFC costs about 600KB, and dynamically linking either costs less than 1KB. >>92
I'm not so sure about GCC, but in general it's possible to get pretty slim binaries if you dynamically link everything, strip/not include debug info(gcc tends to leave a lot of that around), use as little alignment as your executable format allows you, and optimize for less code space usage. Some further cutting down can be done by using a custom entrypoint. That should give you a tiny executable you could get without resorting to packers which compress the code and data and abuse various properties of the executable format to squeeze even more space(sometimes making illegal images, but still recognized by the OS loader).
Name:
Anonymous2009-11-11 18:31
>>93
How can I use a custom entry-point with gcc? It would be nice to get rid of all the bullshit that gcc throws into my application by default (from msvcrt.dll I have __getmainargs, __p__environ, __p__fmode, __set_app_type, _cexit, _iob, _onexit, _setmode, abort, atexit, fflush, and signal, none of which I asked for. And then there's SetUnhandledExceptionFilter, AddAtomA, FindAtomA, GetAtomNameA from KERNEL32.dll that I most certainly didn't ask for)
>>94
I'm not so sure about how to go about it in GCC, but in MS C compiler, you just pass /ENTRY:symbol_name to the linker(link), you can also pass /NODEFAULTLIB (to not link libc if you don't need it) and /ALIGN:# to change alignment. It should be noted though, that if you code in C and use the standard library, you will need to link against it(statically or dynamically). As for the entrypoint, you will no longer have main receive the usual parameters, instead you will probably have no params passed to you at all, in which case, you would have to obtain and parse the command line yourself if you need anything from it (along with whatever other things you may want). This all goes into platform specific code (different on windows and *nix'es), as for the exports you mention, msvcrt.dll stuff sounds like main() code, and it should go away if you set your own entrypoint, as well as the kernel32 code. SetUnhandledExceptionFilter was probably used for giving you a better error message than a simple crash of your application.
Name:
Anonymous2009-11-11 19:14
>>94
You can tag a function with __attribute__((constructor)) and gcc will cause it to be called before main(). Not sure if that's useful to you though, and afaik there's no way to order it with respect to anything else called/constructed before main().
Some of the information applies to old compilers and is a bit outdated, but the core concepts apply even though the methods have changed.
Name:
Anonymous2009-11-11 23:49
>>94
if you link explicitly instead of letting gcc do it, you gain a lot of flexibility. dump ld --help to a file and peruse it. there's lots of goodies there.
as for executable size, I don't think you can cut it down much below 2kb:
~% echo 'int hi(){puts("hello world");return 0;}' > test.c
~% i486-mingw32-gcc -Os -fomit-frame-pointer -c test.c
~% i486-mingw32-ld -s -O -init=hi test.o -lmsvcrt -o test.exe
~% wc -c test.exe
2048 test.exe
~% wine test.exe
hello world
naturally if you don't use puts you can cut it down because you don't need to link anything. doing the same as above (except for the -lmsvcrt of course) I ended up with a 1536 byte file. far cry from the 15kb or even 5kb that >>92 mentions, though it's certainly not 400 bytes it's not horrible either.
I know there's some way to strip off the DOS mode header from the file, I did it before, but I don't remember how. this can save some space. collapsing .idata into .text would help too, but I don't think there's any way to do that with mingw unfortunately.
Name:
Anonymous2009-11-12 0:11
>>97 You're executable will be very small
Is the grammar and/or overall quality of non-trolling 4chan posts so great that after reading 4chan for a while, stuff like this really stands out?
>>98
With MS's toolchain I can get it down to 1024 bytes: D:\Documents and Settings\konata\Desktop>cl /MD /Os /O1 test.c /link /align:4096 /filealign:512 /entry:hi /subsystem:console
t /stub:stub64.exe
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
test.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:test.exe
/align:4096
/filealign:512
/entry:hi
/subsystem:console
/merge:.rdata=.text
/merge:.data=.text
/stub:stub64.exe
test.obj
stub64.exe : warning LNK4060: stub file missing full MS-DOS header; rebuild stub with /KNOWEAS 16-bit LINK option
LINK : warning LNK4108: /ALIGN specified without /DRIVER or /VXD; image may not run
LINK : warning LNK4078: multiple ".text" sections found with different attributes (40000040)
LINK : warning LNK4078: multiple ".text" sections found with different attributes (C0000040)
D:\Documents and Settings\konata\Desktop>wc -c test.exe
1024 test.exe
D:\Documents and Settings\konata\Desktop>test
hello world
I then removed several hundred null bytes from the end of the file which go it to 622 bytes. If mingw lets you play with the alignment options you can probably get similar results.
>>99 Is the grammar and/or overall quality of non-trolling 4chan posts so great that after reading 4chan for a while, stuff like this really stands out?
That's what distinguishes the imageboard rejects from the people who remember world4ch. On /prog/, at least.
>>100
Hello /g/... now please return to where you belong.
Name:
Anonymous2009-11-12 11:47
>>99
I couldn't find any options for mingw to merge sections etc., although ELF ld/gcc can do it. Guess no one on the mingw team cares enough about cutting 1kb off the executable to implement that stuff.
And you can cut the file down further if you write it entirely in a hex editor. (and obviously more if you build a .com file, but that's a different subject)
>>1 do you have any fucking idea how C compilers and likers work? for chists sake all you java niggers going on about how great namespaces are but you have no idea how this is COMPLETELY UNIMPLEMENTABLE.
IDIOTS.
>>111
I have a pretty good idea how they work and how one goes about implementing one. I don't see what the problem with implementing 'namespaces' is (you'll have to elaborate on a more exact definition of the term, but I'll assume it's either the Java/C# idea of a namespace or a module system like Scheme's, or a package system like Common Lisp's). It seems perfectly implementable to me, except that it just won't be C that you'll be implementing.
>>108
So a ``lispnik'' should really be referred to as a sepplenik.
Name:
Anonymous2009-11-12 16:39
>>112
C does not support name-mangling, all symbol names are exported as they appear in the source(with added underscore). This means you'll never see namespaces or classes or function overloading in C. If you really need those features, use C++.
...why write C when you could just write C++? If you really need to, you can write C in C++, but you also get access to a huge library and much more powerful programming concepts. I'm not trying to be a troll. I've really tried to like C. It's just that every time I read somebody else's C code, I have no fucking idea what's happening. I hacked C for a good year before I learned C++, and while I got very proficient, I just couldn't maintain my code when I came back to it later. Is there some sort of book which teaches proper C style? Even still, I see no reason to forsake C++'s extra goodness (especially with so much goodness in C++0x and/or boost.)
>>116 It's just that every time I read somebody else's C code, I have no fucking idea what's happening
Don't blame C. Blame the fuck-knuckles who don't understand how to write readable code in it.
Name:
Anonymous2009-11-12 17:05
>>116
Stop being 12. If you don't like C then use something else. *Please.*
That's not very helpful. I do like C. I love C. I just don't understand why restrict yourself to it alone? As I said before, I can write very readable C, and powerful C. But when I need a map data type, I know it's far more readable to use the STL than to roll my own (probably) flawed (probably) less efficient map type.
Please don't insult me, but offer a compelling exposition of your beliefs, and your reasons for holding them. Programmers tend to like logical and reasonable behaviour.
Is there an online resource, like Practical Common Lisp which teaches clean, reasonable C style and idioms?
>>119
>But when I need a map data type, I know it's far more readable to use the STL
std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > > >
How about no?
Name:
Anonymous2009-11-12 18:27
>>123 Now I am become Death, the destroyer of worlds
>>123
Your convoluted expression only matters in the context of errors with templates, which is a big verbosity/useless error problem.
However,
std::map<std::string, std::string, std::less<std::string> > is not as verbose and can even be decreased.
map<string, string, std::less<string> >
Pretty sure IHBT.
Name:
Anonymous2009-11-13 2:08
>>119
So let me get this straight. Is std::map really the only thing the STL has going for it? The map is the only goddamn thing everyone brings up over and over, so here, courtesy of google, some red-black tree maps in C:
Every goddamn fucking time the C/C++ debate comes up, everyone says over and over how you're going to waste time reimplementing stuff that's already in STL. Do you think C programmers are incapable of re-using code?
Because if I statically link one of the above into my app, it's going to be a fuck of a lot more portable than 'whatever broken STL implementation the platform supports', and it will be smaller anyway without all that template bullshit. And is it really the end of the world if I have to do map_at(mymap, "key") instead of mymap["key"]??
OpenBSD's tree, a full red-black tree implementation in a single header file.
You may also be interested in uthash, a hash-table capable of holding any C struct, also in a single header file. Recall the STL doesn't actually have a hash table.
>>127
Except it does; std::tr1::unordered_map. That tree implementation is also bad. It's either impossible or extremely painful to debug macros. Luckily the people that designed it know precisely how to use it with no errors.
Name:
Anonymous2009-11-13 10:34
>>132
tr1 doesn't count; it's not widely implemented.
Only the OpenBSD tree is built with macros; you generate tree code for each type, template style. There are plenty of other implementations to choose from if you don't like it.
Albert Einstein, when asked to describe radio, replied: 'You see, wire telegraph is a kind of a very, very long cat. You pull his tail in New York and his head is meowing in Los Angeles. Do you understand this? And radio operates exactly the same way: you send signals here, they receive them there. The only difference is that there is no cat.'
[This fortune brought to you by AndroidFortune on the Google phone]
Is so? Then I'll book a seat on YOUR ANUS to Satori Station
Name:
Anonymous2009-11-13 13:50
>>137
So I guess it's infinitely dense? OH YEAH TIGHTEN UP
Name:
Anon. MIT Prof.2009-11-13 14:02
>>139
Your message was perhaps one of the strangest pieces of email I have ever received. Although it is flattering to have a ``faster-than-light anus'', in fact, it is a very bad idea. Unlike most of human society, science and engineering are based on the idea that each of us is capable of evaluating evidence and thinking on our own. Each of us can do experiments, work out the reasoning, and determine the truth for ourselves. There is no room in science or engineering for ``FTL anii'' representing group approval over individual thought. One of my heros, Galileo, put it very well: In questions of science, the authority of a thousand is not worth the humble reasoning of a single individual.
I am pleased to talk with people about matters of science or engineering, so you and your colleagues may certainly send me mail. I hope to learn as much from your experiences as you may learn for me. But please get rid of the ``FTL anus'' way of thinking. The cult of the flying anus is unscientific and ultimately destructive.
Name:
Anonymous2009-11-13 14:24
>>141 But please get rid of the ``FTL anus'' way of thinking. The cult of the flying anus is unscientific and ultimately destructive.
it is was allways my dream to become a asstronaut and fly to mars.
why do you have to destroy my dream like this?