The Refrence C Compiler and a community website.

Discussion in 'C Programming' started by Gautam Sankrant, Oct 6, 2013.

  1. 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
     
    Gautam Sankrant, Oct 6, 2013
    #1
    1. Advertisements

  2. 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 <hidbv3$om2$>
     
    Johannes Bauer, Oct 6, 2013
    #2
    1. Advertisements

  3. Gautam Sankrant

    ruscour Guest

    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..
     
    ruscour, Oct 6, 2013
    #3
  4. 89% of programmers don't care about programming; they just care about
    getting paid and getting home in time for dinner.
     
    Kenny McCormack, Oct 6, 2013
    #4
  5. This may or may not be true, but it is most certainly beside the point.
    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.
    Way to be a straight up honest person, too.
    At least here we agree, although I have different reasons to believe it.
    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.
    Because they need to know C if they are going to touch any code of any
    relevance whatsoever?
    "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.
    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.
    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

    --
    Ah, der neueste und bis heute genialste Streich unsere großen
    Kosmologen: Die Geheim-Vorhersage.
    - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$>
     
    Johannes Bauer, Oct 6, 2013
    #5
  6. Rest deleted. But, man, you have issues.

    See professional help. Seriously.
     
    Kenny McCormack, Oct 6, 2013
    #6
  7. Gautam Sankrant

    Rui Maciel Guest

    <snip more nonsense/>

    You're a poor troll.


    Rui Maciel
     
    Rui Maciel, Oct 6, 2013
    #7
  8. Gautam Sankrant

    ruscour Guest

    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.
     
    ruscour, Oct 6, 2013
    #8
  9. Gautam Sankrant

    Robert Miles Guest

    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.
     
    Robert Miles, Oct 7, 2013
    #9
  10. Gautam Sankrant

    Philip Lantz Guest

    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
     
    Philip Lantz, Oct 7, 2013
    #10
  11. Gautam Sankrant

    James Kuyper Guest

    On 10/06/2013 06:57 AM, Gautam Sankrant wrote:
    ....
    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.
     
    James Kuyper, Oct 7, 2013
    #11
  12. Gautam Sankrant

    Noob Guest

    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
     
    Noob, Oct 7, 2013
    #12
  13. 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.)
    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).
    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.
    Agreed.
     
    Keith Thompson, Oct 7, 2013
    #13
  14. Gautam Sankrant

    James Kuyper Guest

    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.
     
    James Kuyper, Oct 7, 2013
    #14
  15. Yes, that's bug waiting to happen in year 10,000.
     
    Malcolm McLean, Oct 7, 2013
    #15
  16. Gautam Sankrant

    Jorgen Grahn Guest

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

    ....
    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
     
    Jorgen Grahn, Oct 9, 2013
    #16
  17. 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.
     
    88888 Dihedral, Oct 10, 2013
    #17
  18. Gautam Sankrant

    mark.piffer Guest

    Am Sonntag, 6. Oktober 2013 15:45:56 UTC+2 schrieb 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
     
    mark.piffer, Oct 10, 2013
    #18
  19. 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
     
    Albert van der Horst, Oct 25, 2013
    #19
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.