[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Extension to C language: sorry ignore prev "#TCC part
From: |
Stefano Zaglio |
Subject: |
Re: [Tinycc-devel] Extension to C language: sorry ignore prev "#TCC part2#2" |
Date: |
Sun, 03 Jun 2012 20:32:37 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
Hi,
I was a programmer asm/c/c++. Then I was Microsoftnized.
From a long time I have an idea that I'm developing too slowly.
I'm drawing a comparison between C and C++ that would not consider C++
an evolution of C.
Anyway, my proposalmeets the following fees:
1. compatible with TCC "all in one" phylosophy
2. compatible with other C
3. compatible with nature of TCC project:"implements once and forget it"
4. uses TCC as plugin of itself
What follows is part of a longer processing which includes different
points of view including genetic, physical, metaphysical and
psychological. But I do not want to bore.
and I'm asking to who well know TCC code, if this could be possible:
*int* fact(*int* n) { *return *( n==0 ? 1 : fact(n-1) ); }
printf( "factorial of 3 is " #fact(3) );
that will become perfectly:
printf( "factorial of 3 is " "6" );
while the C++ version ... :
*template* <int N>
*struct* Factorial
{
*enum* { value = N * Factorial<N-1>::value };
};
*template* <>
*struct* Factorial<1>
{
*enum* { value = 1 };
};
// example use
*int* main()
{
*const* *int* fact3 = Factorial<3>::value;
std::cout<< fact3<< endl;
*return* 0;
}
is more elegant, not dangerous, unbreakable, yes, I know.
I mean, use the ability of TCC to generate code from
in-code:
*void* config_from_outsource(*char* *param) {
// ...
printf("red,green,blue");
}
...
*enum* colors {
#config_from_outsource("base_colors")
}
...
*void* gen_config() {FILE f;...fopen("config.h","w+");...}
...
#gen_config()
#include "config.h"
...
#import("http://...");
...
#import("compressed_header.gz");
...
#sql_parser(
"select * from tbl where tid=#tid and address@hidden",
"@tid tinyint, @id int",
tid, id
)
...
#expand_your_imagination()
project, make, automake, ml, cmake, deploy can be made all with tcc.
For example, consider the use of #TCC in place of external lemon parser
in sqlite and the integration of tcc in sqlite to add SQL functions.
And I like that Google was financing all of this instead of spending
money trying toreplace JavaScript with Dart, Go & C., because #TCC just
needs a good editor for children, chicken and monkeys like me, with
libtcc, of course, to get or create plugins.
Stefano
PS. Who can be interested in my "Invest in the C instead of C++"
article, I will post soon on my web site.