The Refrence C Compiler and a community website.

  • Thread starter Gautam Sankrant
  • Start date
G

Gautam Sankrant

I would like to point out at some developments in the C++ software world inpast -

-> C++ got a recent standardization from ISO, informally called C++11. It also got a new website isocpp.org, and good endorsements from Google, Microsoft, IBM etc.
-> GCC has switched its implementation language to C++

-> Libraries such as openCV switched to C++

Many of us love C, and though C11 was released, it did not get the same amount of hype as C++11. Much of the industry still depends upon C, and for many people, C is THE language of choice.

I propose that -

-> The community should host a website for C (similar in comparison to Python, Scala, Haskell, and notably C++)

-> It would necessarily be great, if a pure, fully featured pure C compilerwritten in C, acting as a reference implementation for the standard, is promoted among the community (Just like GHC). This endeavor would be great for students as well as developers.

All well, C is a great language and it should get great attention, using its own fully featured compiler and a community.

Regards,
Sankrant
 
J

Johannes Bauer

I propose that -

And here we go...
-> The community should host a website for C (similar in comparison to Python, Scala, Haskell, and notably C++)

"The community" never hosts anything. Individuals host websites. Your
proposal can be paraphrased as "Someone ELSE should REALLY do that!"
-> It would necessarily be great, if a pure, fully featured pure C compiler written in C, acting as a reference implementation for the standard, is promoted among the community (Just like GHC). This endeavor would be great for students as well as developers.

What a moronic proposal.

Why would a fully-featured C-compiler have to be written in C? Do you
thing every assembler is written in assembly language?

And, BTW, nobody stops you from starting writing a "fully featured pure
C compiler". Give it a shot. You might then notice what an ASSLOAD of
work it is. Which is why nobody does it just because it would be super
awesome to have one.
All well, C is a great language and it should get great attention, using its own fully featured compiler and a community.

I'm very excited for your code to appear on GitHub! Post the URL when
you're finished, please.

Until then, please stop the fucking whining.

Best regards,
Johannes

--
Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
- Karl Kaos über Rüdiger Thomas in dsa <[email protected]>
 
R

ruscour

And here we go...






"The community" never hosts anything. Individuals host websites. Your

proposal can be paraphrased as "Someone ELSE should REALLY do that!"






What a moronic proposal.



Why would a fully-featured C-compiler have to be written in C? Do you

thing every assembler is written in assembly language?



And, BTW, nobody stops you from starting writing a "fully featured pure

C compiler". Give it a shot. You might then notice what an ASSLOAD of

work it is. Which is why nobody does it just because it would be super

awesome to have one.






I'm very excited for your code to appear on GitHub! Post the URL when

you're finished, please.



Until then, please stop the fucking whining.



Best regards,

Johannes



--



Ah, der neueste und bis heute genialste Streich unsere großen

Kosmologen: Die Geheim-Vorhersage.

- Karl Kaos über Rüdiger Thomas in dsa <[email protected]>

Wow, you are an enormous asshole. He's not whining, he just had an idea hethought was good and wanted to share. Like seriously, way to just be a straight up horrible person.

As for the OP, there are a few reasons why none of this is going to happen.C is a great language. It's minimal and fast. The problem is that it doesn't solve any problems any more. In the "glory days" of C, you didn't need a community website, you had manpages, free software, newsgroups, IRC channels, etc. What you propose is designed to draw new people into C, but how do you sell them? Why would someone dive into C?

I'm going to make up an arbitrary number here: 90% of programmers don't care about system level stuff, so how do you sell them that they can spend a whole bunch of extra unnecessary time writing stuff themselves that's in standard libraries for other languages that are easier to write in and learn? How do you tell the low-level developers to abandon C++? Sure, there's somuch in the language, it's huge and it's confusing, but even if you use 10% of the language it has roughly the same performance as C with a few more features.

C has its place, but people aren't going to rally around a language nowadays that doesn't help you *do* anything any quicker, easier, or (much) better..
 
K

Kenny McCormack

I'm going to make up an arbitrary number here: 90% of programmers don't care
about system level stuff, ...

89% of programmers don't care about programming; they just care about
getting paid and getting home in time for dinner.
 
J

Johannes Bauer

Wow, you are an enormous asshole.

This may or may not be true, but it is most certainly beside the point.
He's not whining, he just had an idea he thought was good and wanted to share.

He had an idea that he thought was good and wanted OTHERS to implement.
At no point does he display even the slightest amount of work he is
willing to do or possibly has already done towards this goal. This is
not how a "community" works. The "community" is not a bunch of slaves
that work for you whenever you think you have a brilliant idea.
Complaining that something doesn't exist that you're not willing to
invest in yourself qualifies as "whining" in my opinion.
Like seriously, way to just be a straight up horrible person.

Way to be a straight up honest person, too.
As for the OP, there are a few reasons why none of this is going to happen.

At least here we agree, although I have different reasons to believe it.
C is a great language. It's minimal and fast. The problem is that it doesn't solve any problems any more.

Absolute bullshit. "It doesn't solve any problems any more", are you
kidding? Take a look around and tell me in what language DBMS are
written, operating systems are written, compilers and interpreters are
written. You will see that C is used in a VAST array of projects and
apparently solves lots of problems.

That C doesn't solve "any problems" is absolute and utter drivel.
What you propose is designed to draw new people into C, but how do you sell them? Why would someone dive into C?

Because they need to know C if they are going to touch any code of any
relevance whatsoever?
I'm going to make up an arbitrary number here

"arbitrary" being the key word here. Just becasue you don't care about
system level stuff doesn't mean this applies to 90% of other programmers.
How do you tell the low-level developers to abandon C++?

Low-level development is almost always done in C, not in C++. It figures
you wouldn't know that since you have demonstrated clearly you have no
clue about low-level programming.
Sure, there's so much in the language, it's huge and it's confusing, but even if you use 10% of the language it has roughly the same performance as C with a few more features.

And some features less, too, that are kind of important for low-level
development (which, I stated before, you're clueless about). Designated
initializers come to mind. And annoying name-mangling of C++ which make
interworking with C-code annoying.

Regards,
Johannes

--
Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
- Karl Kaos über Rüdiger Thomas in dsa <[email protected]>
 
K

Kenny McCormack

This may or may not be true, but it is most certainly beside the point.

Rest deleted. But, man, you have issues.

See professional help. Seriously.
 
R

Rui Maciel

Wow, you are an enormous asshole. He's not whining, he just had an idea
he thought was good and wanted to share. Like seriously, way to just be a
straight up horrible person.

As for the OP, there are a few reasons why none of this is going to
happen. C is a great language. It's minimal and fast. The problem is
that it doesn't solve any problems any more.

<snip more nonsense/>

You're a poor troll.


Rui Maciel
 
R

ruscour

(e-mail address removed) wrote:










<snip more nonsense/>



You're a poor troll.





Rui Maciel

What use case does C have for someone that this kind of community website would appeal to? I still write stuff in C, just did a big project that needed MPI and OpenMP (and didn't want to cross the border into C++ for a few minor niceties), and it's good and fast and I like working with the GNU toolchain a lot.

It seems like every month you see a new post somewhere saying that C isn't dead, you can still use it for modern projects, look someone wrote a C web framework that's inferior to the zillion others in Ruby/Python/Java/Scala/Go/whatever. How do you sell C to a developer? If you're not already writing it, it probably doesn't solve any problem you have.

I'm not trying to troll, hell, help me understand if I'm so blatantly wrong, because I like C. It just seems to me that the type of thing the OP is suggesting doesn't fit what C currently offers.
 
R

Robert Miles

What use case does C have for someone that this kind of community websitewould appeal to? I still write stuff in C, just did a big project that needed MPI and OpenMP (and didn't want to cross the border into C++ for a fewminor niceties), and it's good and fast and I like working with the GNU toolchain a lot.

I've recently seen an article saying that GNU is planning to have their C compiler converted from being written in C to being written in C++, in orderto
get more people who can help maintain it.

I suspect that the libraries C programs use will still have to be written in C, though, unless some new C++ standard defines a way to declare that certain ways
to call C++ routines are not to use the usual name mangling.
 
P

Philip Lantz

Robert said:
I've recently seen an article saying that GNU is planning to have
their C compiler converted from being written in C to being written
in C++, in order to get more people who can help maintain it.

I suspect that the libraries C programs use will still have to be
written in C, though, unless some new C++ standard defines a way
to declare that certain ways to call C++ routines are not to use
the usual name mangling.

Why? What's wrong with the way the current C++ standard defines to
declare that certain C++ routines are not to use the usual name
mangling?

(I don't doubt your conclusion, by the way, just your reason.)

Philip
 
J

James Kuyper

On 10/06/2013 06:57 AM, Gautam Sankrant wrote:
....
-> It would necessarily be great, if a pure, fully featured pure C compiler written in C, acting as a reference implementation for the standard, is promoted among the community (Just like GHC). This endeavor would be great for students as well as developers.

What would such a "reference" compiler achieve that is not already
achieved by the existing open source implementations of C?

Much of what any C compiler does is outside the scope of the C standard.
Of those things that are in that scope, many are deliberately
unspecified. For each aspect unspecified by the standard, a reference
implementation would have to make a choice, and I'm very much afraid
that many people will derive the mistaken conclusion that the choices
made for the reference implementation are the only permitted ones. A
slightly less foolish, somewhat more plausible, but equally dangerous
misinterpretation would be that the choices made for the reference
implementation have somehow been endorsed as superior to the other
alternatives.

If that seems unlikely, consider that early versions of the standard
contained the full text of an excessively simple implementation of
rand(), that produced very low-quality random numbers. As a result, a
great many implementations used exactly that implementation. Some of the
implementors were simply being lazy, but others honestly thought,
without bothering to check, that it was endorsed by the C standard as an
acceptably good implementation.

Another example is asctime(), where the decision was made to define the
required behavior in terms of matching the behavior of example code. I
think this was a bad decision, but for some reason no one consulted me
in the matter :).

Some people have mistakenly concluded that it is therefore required to
implement asctime() in exactly that way - they don't understand that the
phrase "using the equivalent of the following algorithm." allows for the
use of other algorithms. That example code has undefined behavior for
many possible values of the argument - usually in the form of reading or
writing before the beginning or past the end of an array. It is quite
feasible to implement asctime() in such a way as to detect such
problems, and to avoid them - it could return either a null pointer, or
a pointer to a string containing some indication of what the problem
was, or a pointer to a string residing in an array long enough to allow
for the longest possible output from each of the %d format specifiers.

Since the behavior in those cases is undefined in those cases, any
behavior is allowed for a fully conforming implementation of asctime(),
including, in particular, the behavior that would be produced by the
more useful alternatives I've suggested. Yet, I've seen people argue
that asctime() must be bug-for-bug compatible with the example code in
the standard.

I don't think it would be a good idea to create an entire reference
implementation of C filled with opportunities to trigger similar
misinterpretations.
 
N

Noob

Robert said:
I've recently seen an article saying that GNU is planning to have
their C compiler converted from being written in C to being written
in C++

This has already happened (about a year ago).


http://gcc.gnu.org/ml/gcc/2010-05/msg00705.html

From: Mark Mitchell <mark at codesourcery dot com>
Date: Sun, 30 May 2010 17:26:16 -0700
Subject: Using C++ in GCC is OK


http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html

From: Diego Novillo <dnovillo at google dot com>
Date: Thu, 02 Aug 2012 11:58:06 -0700
Subject: Merging the cxx-conversion branch into trunk
 
K

Keith Thompson

James Kuyper said:
If that seems unlikely, consider that early versions of the standard
contained the full text of an excessively simple implementation of
rand(), that produced very low-quality random numbers. As a result, a
great many implementations used exactly that implementation. Some of the
implementors were simply being lazy, but others honestly thought,
without bothering to check, that it was endorsed by the C standard as an
acceptably good implementation.

Early versions? The C90, C99, and C11 standards all have the same
sample implementation of srand() and rand(). (It's not as bad as some;
at least the generated numbers don't alternate odd and even.)
Another example is asctime(), where the decision was made to define the
required behavior in terms of matching the behavior of example code. I
think this was a bad decision, but for some reason no one consulted me
in the matter :).

Unfortunately, C code is probably the most unambiguous way to define the
algorithm. You could define it in English, but the description would be
much longer (and, unless it's written *very* carefully, likely even more
subject to argument).
Some people have mistakenly concluded that it is therefore required to
implement asctime() in exactly that way - they don't understand that the
phrase "using the equivalent of the following algorithm." allows for the
use of other algorithms. That example code has undefined behavior for
many possible values of the argument - usually in the form of reading or
writing before the beginning or past the end of an array. It is quite
feasible to implement asctime() in such a way as to detect such
problems, and to avoid them - it could return either a null pointer, or
a pointer to a string containing some indication of what the problem
was, or a pointer to a string residing in an array long enough to allow
for the longest possible output from each of the %d format specifiers.

Since the behavior in those cases is undefined in those cases, any
behavior is allowed for a fully conforming implementation of asctime(),
including, in particular, the behavior that would be produced by the
more useful alternatives I've suggested. Yet, I've seen people argue
that asctime() must be bug-for-bug compatible with the example code in
the standard.

C90, C99, and C11 all say that asctime() must be implemented
"using the equivalent of the following algorithm", followed by C
code that implements asctime(). I've argued myself that C90 and
C99 require implementations to behave like the specified algorithm
for cases where that algorithms behavior is defined. For example,
it uses sprintf() with a "%d" format for 1900 + timeptr->ym_year,
with the implicit assumption that that's going to be 4 digits; if
it's fewer than 4 digits, that leaves room for other fields to be
outside their normal ranges. I've also argued that an implementation
can do anything it likes in cases where the presented algorithm's
behavior is undefined.

For example, under C90 and C99 rules, I believe that this program:

#include <stdio.h>
#include <time.h>
int main(void) {
struct tm t;
t.tm_sec = 999;
t.tm_min = 42;
t.tm_hour = 42;
t.tm_mday = 999;
t.tm_mon = 0;
t.tm_year = -1858;
t.tm_wday = 0;
fputs(asctime(&t), stdout);
}

must print:

Sun Jan999 42:42:999 42

(Look at the asctime() algorithm in the standard; its behavior is well
defined for those values.)

This is a disadvantage of describing the algorithm in C; any quirks in
the C code become requirements.

C11 adds this:

If any of the members of the broken-down time contain values
that are outside their normal ranges, the behavior of the
asctimefunction is undefined. Likewise, if the calculated year
exceeds four digits or is less than the year 1000, the behavior
is undefined.

which makes my program's behavior undefined.

Personally, I'd be happier if that paragraph started with "Except
that", since strictly speaking it contradicts the previous text.
I don't think it would be a good idea to create an entire reference
implementation of C filled with opportunities to trigger similar
misinterpretations.

Agreed.
 
J

James Kuyper

Early versions? The C90, C99, and C11 standards all have the same
sample implementation of srand() and rand(). (It's not as bad as some;
at least the generated numbers don't alternate odd and even.)

I thought they'd fixed that in C2011 - I looked under rand() (7.22.2.1),
and didn't find it. It's actually on the next page of the standard,
under srand(), as I should have remembered.
 
M

Malcolm McLean

For example, it uses sprintf() with a "%d" format for 1900 + timeptr-
ym_year, with the implicit assumption that that's going to be 4 digits; if
it's fewer than 4 digits, that leaves room for other fields to be
outside their normal ranges.
Yes, that's bug waiting to happen in year 10,000.
 
J

Jorgen Grahn

On Sun, 2013-10-06, Gautam Sankrant wrote:

....
-> The community should host a website for C (similar in comparison
to Python, Scala, Haskell, and notably C++)

I know Python has one, and I wouldn't be surprised if Scala and
Haskell do. But C++ does certainly not have a community website.

C++ is like C that way. Really old languages without a single an
implementation, a Benevolent Dictator for Life, or a big company
designing it around business plans, stuff like that. For better and
for worse.

/Jorgen
 
8

88888 Dihedral

What use case does C have for someone that this kind of community websitewould appeal to? I still write stuff in C, just did a big project that needed MPI and OpenMP (and didn't want to cross the border into C++ for a fewminor niceties), and it's good and fast and I like working with the GNU toolchain a lot.



It seems like every month you see a new post somewhere saying that C isn't dead, you can still use it for modern projects, look someone wrote a C web framework that's inferior to the zillion others in Ruby/Python/Java/Scala/Go/whatever. How do you sell C to a developer? If you're not already writing it, it probably doesn't solve any problem you have.



I'm not trying to troll, hell, help me understand if I'm so blatantly wrong, because I like C. It just seems to me that the type of thing the OP issuggesting doesn't fit what C currently offers.

For those who care about new
instructions of CPUs and OSes , C is still the number one portable assembler and system programming
language.

But in the higher level applications
programming languages in the
5-th or 6 -th gens are better in
applications.
 
M

mark.piffer

Am Sonntag, 6. Oktober 2013 15:45:56 UTC+2 schrieb Rui Maciel:
(e-mail address removed) wrote:










<snip more nonsense/>



You're a poor troll.





Rui Maciel

No, he is Dan Pop's rightful heir. IMHO c.l.c can live with such individuals as long as their topical output is correct and to the point...

Mark
 
A

Albert van der Horst

So back to the topic, there is no reason at all why a C compiler should
be implemented in C - there are other languages that better suited.
(Historically, of course, most C compilers have roots that go back to a
time when C /was/ the best choice of language for such programs.)

There is a reason for the GNU compilers to be written in C.
That is bootstrapping. I remembered having problems with the
c-compiler on SUN. The licensing just didn't work. But I could
use the SUN compiler we had a working license for, to compile GNU-c.
Then recompile GNU-c with the new compiler, and voila, you're
totally there.

Moving to c++ goes against the spirit of laying the ultimate weapon of
a portable compiler in the hands of the worlds programmers. It seems
that they think weapons are no longer necessary once you've conquered
the world. We'll see.

(I admit I'm a minimalist and I want to go to the roots and have
absolute control. See yourforth at bitbucket.org for a compiler defined
in assembler. One source file. )



Groetjes Albert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top