In embedded application why c is most poppular? [closed] - c

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
see ,
still yet i have seen that most of the embedded application are written in c.
Most of the libraries are written in c.
Device-driver are written in c.
So i want to ask you is there any logical reason behind this?
(My apologies if this post sounds silly/stupid. I thought I'd ask here. Ignoring these core bits never made anyone a better programmer.)

There are many reasons, including but not limited to:
It has access to many low level functions not accessible from many other languages.
It has existed for many many years and has lots of developers that are familiar with it.
If written well it's extremely efficient.
It gives almost complete control over memory etc.
It's very portable, largely due to the myriad of compilers written for it.

Because of Dennis Ritchie. C is easily the most portable language.

Related

Programming an old console, Magnavox Odyssey 2? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Ive been searching around and I couldnt find anything on how to really begin programming for the Odyssey 2. I thought it was be kind of fun to mess around with one, to maybe try and program a simple game. But I wanted to know how I could begin. Like for example what is the console coded with, assembly? C?
Is there any example code online? Are there some tutorials?
I have been trying to find some, but have had no success.
It has only 64-bytes of memory, so yes, you need to use assembly.
There is an open-source, well commented game Kill the attacking aliens which should help you get started. When in doubt, you can also check the source codes of Odyssey² open-source emulators o2em.
There is also a good deal of documentation of the system here (this page in particular).
It has an Intel 8048 CPU, so you're probably pretty much stuck with assembly language -- I don't know of any compilers that target an 8048, and with only a couple hundred bytes of RAM available (only 64 bytes of that for general-purpose use), it doesn't seem like a good target for a compiler either. There are a few 8048 assemblers around, mostly of them freely downloadable. You can also dig up a few Odessey 2 emulators if you do a little looking (again, at least some are free).

How to start building a programming language in C? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I really would love to go through the experience of building a compiler, lexer, and so on using C, however I havn't found a single resource on creating one. I've read the book about creating your own language using Ruby, but it just talks about how C is the best option, and won't tell you where to go from there.
Is their any nice resources for building a language using C? I don't care how long it is, I just want to know how to build one.
One of the nice things about compilers/interpreters is that it doesn't really matter what language they are written in. In the final stage they will just be an executable on someone's machine.
That being said while writing my compiler (something I am currently doing) I have used several books that have been extremely helpful:
Compiler Construction by Niklaus Wirth
Compilers Principles, Techniques, and Tools by Jeffrey Ullman, Alfred Aho, Ravi Sethi
The Wirth book will walk you through all the stages of creating a compiler for a language called Oberon-0. It also has the entire source code for his finished compiler, so you can play around with it on your own machine. The compiler itself was written in Pascal (something else that Wirth created).
The Dragon Book has really good information and examples in C! This may be what you are looking for, but as I said above, the language you write the compiler in isn't all that important.

Is it possible to write Tower Defense in C/SDL [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have to write Tower Defense game in ANSI C using SDL library, but the deeper I go into LazyFoo's tutorial, the more I got this feeling that's impossible to write it in pure C due to limitations. So my questions is - am I in big trouble or I'm just panicking. It has to be a simple tower defense game, nothing fancy, but is it possible to do it using only C?
C is a Turing-complete language so anything you can do in some other language can be done in C, too. And SDL provides you with a graphics API which is commonly used for (usually small/indie) games.
Of course it might be more pleasant to write it e.g. in C++ or a higher-level language such as C# or Python - but it's possible in C nonetheless.
TL;DR: Yes, it is totally possible.

How do I detect critical sections in a C program by analyzing it programmatically? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I want to create a tool which analyzes a C program for critical sections during the compilation phase. I am looking for the right algorithm which would let me do this. It can be at any phase of the compiler.
You may be interested in this article “Static analysis of run-time errors in embedded real-time parallel C programs”.
The Frama-C plug-in mthread was developed simultaneously and independently. It works on comparable principles.
Each of the above two tools is man-years of work over an existing base that already represents at least ten man-years of work. As some have already commented, if you want to do anything significant and useful for the kind of moderately large program that you cannot just read to convince yourself that it is correct, you are going to have a lot of work.

A book for C beginners [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am a PHP developer, and now I want to learn C for a couple of reasons.
I lack knowledge in Java, as well as data structures and algorithms.
PHP is written in C.
The most important thing is the first reason. I don't want to get deep into C, but at least I could understand what C programs are doing. Does anyone have any good idea how I should proceed? Thanks!
That's probably the wrong approach. First learn the basic theory behind programming which is algorithms and datastructures. These are language neutral.
Than try to learn a language and its syntax to write your algorithms. To answer your question, a good book for C is C in a Nutshell but it DOES NOT teach you the basics of programming.
And then there is still the book The C Programming Language by Kernighan&Ritchie, who invented C.

Resources