Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
Is there any small c compiler which follows ansi c extensions and still it has less than 10,000 LOC. Basically 'm trying to port such small compiler to one of such educational OS kernel known as xv6. Thanks.
I don't think that's possible. You might try something like https://github.com/alexfru/SmallerC , a very small compiler for a subset of C. (See the wiki for the language)
Or look at pcc, but that is significantly larger.
It turns out xv6 badly needs several improvements in order to host a decent C compiler or just an assembler and a linker:
larger maximum file size (currently capped at around 64KB)
lseek
FPU state saving/restoring on context switches
A few other minor improvements may be needed.
Links:
Increasing the filesystem block size in the xv6 OS
system calls & toolchains
The smallest one I know is TCC http://bellard.org/tcc/ which has around 30 000 LOC.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
According to "Schema Validation with Intel® Streaming SIMD Extensions 4 (Intel® SSE4)" (Intel, 2008) [they] added instructions to assist in character searches and comparison on two operands of 16 bytes at a time. I wrote some basic strlen() and strcmp() functions in C, but they seem slower than glibc.
I would like to maybe experiment with using inline assembly to see how my project behaves with inputting/outputting XML.
I've read (on here) that using SMID on things like strlen() is rife with potential problems (memory alignment), so I'm a little concerned about using it in production code.
glibc's implementations will be hard to beat. These functions are carefully optimized and include pieces hand written in assembly. Here is glibc's x86_64 implementation of strcmp, using AVX2 instructions. Be warned, it is 800 lines:
https://github.com/lattera/glibc/blob/master/sysdeps/x86_64/multiarch/strcmp-avx2.S
For more detail, read also Peter Codes' fantastic explanation about glibc's implementation.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Wikipedia says that "Newlib is a C standard library implementation intended for use on embedded systems". OK, but where can I find the latest canon version of it? i.e the correct true complete version.
Also, what other libraries exist for C language? Could you give me the ISO numbers for them?
I am trying to understand what library types/versions exist for C language so I know what they mean when I come across them in the future.
I would expected C standard library to be called just C standard library but that is not used and these different names like newlib do not seem very easy to decipher.
It is one of many implementations of the standard C library. Here are some other implementations:
http://www.musl-libc.org/
https://www.gnu.org/software/libc/
This is a fine comparison of 4 different implementations. It might be easier for you to understand why people create their own implementations: http://www.etalabs.net/compare_libcs.html
They differ in speed, compilation time, supported architectures, number of lines of code in the code base, compatibility with the standard, license and so on.
Python, for example, has various different implementations as well - see this answer: https://stackoverflow.com/a/17130986/4694621.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have following problem:
I work on powerful Intel CPU (8 cores). For this target I compile from source an old in-house C application using gcc. It's single-threded application, so created binary doesn't take any advantage from having multi-core cpu and single core runs at nearly 100% load. Is there some way to utilize other cores without changing source code?
How do I prompt gcc to automatically parallelize the program without explicit multithreaded programming? What hints can I give the compiler in the program?
You could try the gcc flags to auto-parallelize loops (-floop-parallelize-all -ftree-parallelize-loops=8) which uses pthreads. You have to be careful how you write your code of course, the compiler has to know there's no dependance between each iteration of your loop in order to be able to parallelize it.
But to be honest, you get nothing for free, unless your code is designed for multiple processors then you will never gain much.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have been trying to find a tool (hopefully for MAC OS X but I don't mind migrating) -- that works -- for those dimensions but I had no luck. Maultech mention some, and so does this page but I was unable to make them work. Metre and ccount (listed on that page) seems to cover most of what I wanted. The tools also seem not up to date no anymore with makes me unsure if the outputs can still be trusted.
Is there any current C tool that can do this that is free or open source? Most of what I found is for Java or OO.
By simple metrics I mean for example calculating amount of, characters, blanks, functions, methods, amount of statements, depth of nests, etc.
By Size I mean line of code, and comments.
By Complexity I mean mccabe and halstead metric at the very least.
By Couple and Cohesion I mean interaction between function calls etc (this is a known SE principle).
I usually use Frama-c.
You may want to take a look at its metrics plugin (McCabe's cyclomatic complexity, Halstead complexity, Value analysis coverage estimate, etc)
What is Frama-C ?
Frama-C is an extensible and collaborative platform dedicated to source-code analysis of C software.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Anyone know of a good statistics library for C? I'm looking for something that is commonly used and not a small project. EDIT: must be free!
gsl (http://www.gnu.org/software/gsl/) is widely available, portable, and has a lot of nice functionality.
Statistics are frequently done in other languages, but some of those languages will be callable from C. I'd recommend looking at R and Octave; the latter is an open source Matlab work-alike. Both are programming languages in their own right, but many other languages can be called from C.
In my opinion, MATLAB is a very good choice you can use for that. Here is an article on how to call MATLAB from C.
It ain't cheap. But you did not specify anything about the library being cheap or free. Plus, you are mentioning it's a big project.... :-)