Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It sounds like you are saying that auto-generating refers only to DSL's. Here is an example of a guy writing some code that printf's some C code - http://www.opensource.apple.com/source/zlib/zlib-37.2/zlib/c...

        FILE *out;

        out = fopen("crc32.h", "w");
        if (out == NULL) return;
        fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
        fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
        fprintf(out, "local const unsigned long FAR ");
        fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
        write_table(out, crc_table[0]);
This example is in zlib. Whether it's the 'pretty' way to do it or not, this isn't a terribly uncommon thing to see in C code bases. In this case, this is a lookup table. Code is a tool, "auto-generating" code is not some fancy term, all it means is a button was pushed and a bunch of code came out the other end. Having worked on large C codebases, we used to do this sort of stuff all the time. Maybe it's the dumb way of doing things, but when you work on large teams that all maintain the same codebase, dumb and readable is more important than cleverness sometimes.


This doesn't change the point the top-level comment was making. Even if some N lines of C spit out some M lines of different C (hopefully with N < M), the actual code written by the programmers is the code that should be counted, not the generated code.

In the case you describe, the language used to generate the code is C, but the concept doesnt change. This is where you are being disingenuous by means of pointless pedantry.


should counted != counted

most of the time line counts are just .c and .h in the file tree, and the generated files to often end up in the file tree and repository.

I'm merely speaking from my own extensive experience in dealing with large C code bases. What you are calling disingenuous and pedantic is ignoring where the hand-wavy line count numbers actually come from. The tend to come from code that is actually checked into the repository which, whether you like it or not, can include large amounts of auto-generated code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: