Does comment style affect binary size? [closed] - c

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am getting started to the embedded system's world. During this journey I came across to a "different" way to comment functions:
ISR(INT0_vect) { /* Run every time there is a change on button*/
I particularly prefer something like:
// Run every time there is a change on button
ISR(INT0_vect) {
Is it just a "taste thing" or by commenting like that I can "save" some EEPROM space in my ATMEGA168A?

The style of comments is purely an aesthetic concern. Compilers disregard all comments in your code when generating an object file, so how you format comments will have no bearing on EEPROM space.

Related

Historically, why asterisk for a pointer/indirection in C? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed last month.
Improve this question
One of my students asked why C would use * for pointers since it's already the multiplication operator. I didn't have a good response. I looked into some of the history, but couldn't find a "why". Hoping some of you might have been around a bit longer than me and know why * for pointer/dereferencing/indirection.
I understand this is not necessarily a coding-question per say, so some might get upset it is posted on Stack Overflow, but I know of no better place to ask this question.

How to store value of a variable in c after closing [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am doing a project on railway reservation system, my program is working fine, but when I close the program and then again start booking tickets,seat no again takes the previous value, I'm doing the project in c.
You'll need to write all of the data to a file before the program closes, and then read the data from the file when the program starts again.
That's right.

How to implement the printf function in risc-v? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Here's the C representation of what I'm trying to do in RISC-V assembly:
printf ("x=%d\n", x);
https://godbolt.org/ is an interesting site. If you paste in c code, it can be transfered into others, such as RISC-V assembly. The sample c code is available from menie.org/georges/embedded/small_printf_source_code.html. It does work. Good luck.
Here is a very simple printf (actually only integers and strings and no advanced formatting)
https://godbolt.org/z/sgMVs7
It is not my code - it is tiny ptinf from the atolic studio. But it is a good base to implement something simple but more decent.

different execution time or the same with different options? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
If i compile a C program with different options like '-o, -o2, -o3' Will there be any difference in the execution time or memory utilization?.
Maybe.
Depends. You're telling the compiler to spend a bit of additional time into looking for places where it could probably optimize the code from the standard approach. It might find such places, but it also might not. On all but the most trivial programs, there is, however, quite a high probability the compiler will be able to optimize ("Hello World" doesn't optimize very well, though...).

why do most file formats define a start of file marker? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
For instance jpeg (JFIF) has a SOI (start of image) marker. One can argue that it can be used to identify the type of file, but I'm looking for more sound reason with supporting examples.
These are often referred to as "signature bytes" and their primary purpose is simply to aide in validating the file. Some file types contain additional signature bytes elsewhere in the file (ie: BMP format), and some contain none at all. The latter kind still generally provide some other means to validate the file using a variety of techniques, such as checksums, stored file size and the like.

Resources