|
From: | Christian Jullien |
Subject: | Re: [Tinycc-devel] Extension to C language |
Date: | Tue, 29 May 2012 06:27:21 +0200 |
Paulo, I’m not tcc maintainer and I only speak for myself, reference falls in the same category: incompatible C extensions. This a debate that sooner than later comes for C implementations: should we extend the language to make a better C? There is already a better C which is called C++, if you want to extend C with some C++ features, joe will explain you that XXX is a must have while sam will advocate for YYY because its code intensively uses it. At the end, you’ll fall to implement half cooked semi-broken incompatible C++ language that no one wants to use. That’s why I vote to a pure C implementation with (perhaps?) gcc compatibles feature if it helps portability. If you need C++, use C++ which unfortunately tcc is not and probably never will be. Again, it is my own opinion but, unless there is a strong consensus for reference (which I doubt) I personally prefer you remove it. Christian From: address@hidden [mailto:address@hidden On Behalf Of Paulo Henrique Torrens This reminds me of something... I've added reference variables too (like in C++), should I post here a patch for that too, or should I remove it too before posting any patches? From: address@hidden Hello, I really enjoy your efforts to implement C11 features in tcc which is of course a good decision. IMHO, C11 additions should be only available using a compiler flag. Gcc uses for example –std=xxx to specify the C level you want to support. For C11, gcc uses –std=c11 and –std=iso9899:2011 Since tcc supports some gcc compatible flags, I strongly suggest you use both. I’m however against any C extensions that has no roots in C standard. The reasons are: - It makes your program incompatible with other C implementations - It makes tcc more complex to maintain - Your implementation only works with malloc while there are many other ways to allocate resources (mmap, suballocators, shared mem…) I clearly understand your need for such an extension, but please keep it as private. M2c Christian From: address@hidden [mailto:address@hidden On Behalf Of Paulo Henrique Torrens Yes, I made some changes for it to produce native binary files on Mac. And the C11 updates are pretty much to be approved and used. I made this changes because I don't want my compiler project to have any dependencies, so I want to encourage the use of TCC as bootstrapper compiler when needed. GCC is too big. Also... because I think it's fun to play with compilers. The changes for tracked variables are not that complex, and I added them to TCC before my compiler was even working in order to test them... I think I am just asking the main contributors: do you want a patch for this feature? If there is no interest in this, at least was a good practice for me, then I'll remove it from my working directory and make a patch for the remaining changes. :) Thank you for your answer. Date: Mon, 28 May 2012 23:20:09 -0400 On 28 May 2012 22:52, Paulo Henrique Torrens <address@hidden> wrote: Hi, I'm working on a compiler suite project (black.nongnu.org), and made several updates to TCC in order to incentive it's use as bootstrapper compiler and for "publicity", including port to Mac OS X and the Open/Free/Net BSDs (and planning on fixing for Android), the C11 _Atomic, _Alignas and _Generic keywords, and some other stuff. I plan to send a patch soon. I've made a small extension to my compiler, making "tracked variables" in C. They are just reference counted structs which can call free() automatically. void test() { int ^strong = malloc(sizeof(int)); printf("strong has %d references", countof(strong)); int *weak_reference = strong; // countage for strong becomes 0 and free(strong) is called automatically }; Should I update this patch too? I mean, would this extension (enabled with -ftracked-variables) be used into the main branch? Anyway, I will update all the other patches soon. :) Greetings.
|
[Prev in Thread] | Current Thread | [Next in Thread] |