Comments (6)
@wolf99 Non-hosted environments are a valid point. However, I look at it from the other side. Learning C as it is now should be the goal. Later you can easily restrict the features you use and adapt to a more limited environment. IMO, learning the language should not be restricted because of that.
@siebenschlaefer No, the exercises (haven't solved all yet) are also solvable with older versions. But I found using newer features often made it easier.
from c.
I thougth that most of the "quality of life" improvements I use came from C11 onwards, but looking it up it appears most of them have been introduced by C99 already.
For example, compound literals:
int *p = (int [2]){1, 2};
Or array initialization with designators:
int a[] = { [2] = 3 };
For C11 I can only point to anonymous struct members:
struct foo {
int i;
struct {
int a;
int b;
};
};
...
struct foo f = { .i = 10, .a = 200, .b = 300, };
...
Other than that, I regularly use bounds-checking versions of functions (e.g. strcpy_s
instead of strcpy
) were appropriate.
IMO multithreading is a major addition from C11 that is worth learning. But that can be an extension to the already existing exercises. Would a PR that adds such types of exercises be welcome?
I think we can close this issue ;)
from c.
But I found using newer features often made it easier.
That's what I wanted to know. Do you have an example for that?
from c.
Hi!
Thanks for the good question and for finding and referencing the past question!
GCC and Clang do indeed support recent C standards in hosted environments (e.g. environments with an OS).
However C is still used heavily in non-hosted environments (bare-metal, RTOS, near-hosted, etc). These environments usually only support much older versions of C. Additionally Microsoft's MSVC only supports C to C99 (last I looked, the situation may have changed since; but C is always second citizen to C++ for MS).
Thus having an older standard caters to the lowest common denominator of students that may use the track.
That said, I don't know if this is something we specifically aim for. FWIW I have no specific objection to moving to newer standards.
Off the top of my head however I can't think of any currently existing exercise on the track that would make use any of the features of the newer standards (I'm not super familiar with the new features either!).
Are there any specific features that you had in mind?
from c.
No objections from my side, I'm fine with either.
Just out of curiosity: Would that have any impact on the solutions?
I'm not aware of any exercise where a C11 or C17 solution would look significantly different.
from c.
It would be good to have a submission for an exercise that demonstrates multithreading!
However I don't know if we have a way of requiring a multithreaded implementation to any exercise via the test framework.
If you have ideas for how to do it it would be good to hear it
(Bear in mind that exercises on any track are implementations of problem specifications from the problem specs repo)
from c.
Related Issues (20)
- Implement the exercise "reverse-string" HOT 1
- Implement the exercise "high-scores" HOT 9
- Change to "community-contributions-accepted" HOT 2
- Expected and actual assertion arguments reversed in some tests HOT 2
- Docs: test framework overview links to empty article HOT 1
- More documentation to `Grade School` HOT 1
- Add `make memcheck` tip for the HELP.md file. HOT 1
- Building a training set of tags for c HOT 23
- Rework the gigasecond exercise? HOT 3
- Problems in pascals-triangle test HOT 12
- The order of the results actually matters for the Word Count exercise HOT 4
- Pascal's Triangle has a bad Test Case defining Zero Rows. HOT 2
- Exercises for #48in24 HOT 17
- pig latin in C track HOT 2
- Grade school : ARM64 - Some tests fail when run online HOT 5
- The square root problem needs to be improved HOT 4
- Return type for `convert(char result[], int drops)` in "Raindrop" should be of type `void` HOT 2
- Approach is missing in "Hamming" HOT 5
- Jumped right from Hello World to Armstrong Numbers? HOT 5
- Use of macros in "Series" isn't clear, consideration for removal? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c.