The attacks, dubbed Bluetooth Impersonation AttackS or BIAS, concern Bluetooth Classic, which supports Basic Rate (BR) and Enhanced Data Rate … I think it may be able to obsolete many/most uses of C some day. It's just that the kind of default styles that people, especially beginners, tend to use that often look archaic. Read, view comments, bookmark and share stories from the hacker news feed! But I feel like you are asking for a "spec" level document on modern C, when you are reading a more practical work on it. Is this a good resource for someone using it to improve their C skills, and not necessarily writing a lot of C? So your name calling isn't even accurate in this case. But I'm terribly sorry if you didn't get it. Displays recent stories from Hacker News. For example, with the details you provided (of which there isn't much) I would suspect a thread safety issue. Collapse. Agreed with the commenter elsewhere in this thread that Zig seems like a more reasonable contender for a modernized descendant of C. Rust was designed by C++ programmers, to replace code that was previously written in C++. it is making a joke about social problems in a group that has the systemic advantage. Namecalling ("SJWs like you") is against the hacker news guidelines. Not sure what the siblings are on about. There's no right answer, and appeals to spoken language aren't particularly compelling when bikeshedding C of all languages. Clear.  https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...  https://www.eskimo.com/~scs/cclass/notes/top.html, If there is a book as good as K&R and covers the new ideas, I'm interested to learn about it! Pelles c also supports them. Useful when your project uses autotools. It doesn’t take me a lot of extra time to document the general idea behind a piece of code and it makes my future life and that of other devs reading the code so much easier it’s easily worth the effort to write these comments and keep them up to date. > Takeaway 220.127.116.11 Don’t use the , operator. I did not even have a computer at that time, so I wrote most of the exercises on paper. Easily my favorite programming book for any language. 3. Getting it right takes time, practice, and a few stubbed toes. 11 members in the fastvoted community. > Lots of deliberately bad C code. There’s a very vocal group that tells you not to write in C because it’s unsafe, immoral and you’ll burn in hell if you do but the fact is...I would never be able to understand the problem Rust is trying to solve until I’ve recreated the problems in C. By now I’ve hit a good amount of segmentation faults. ... Fast, modern & flexible Hacker News reading experience, for phones & tablets. Hacker News offered by adam.albrecht (60) 1,000+ users. Sure, except for the part where C is a language that uses English or English-based keywords, designed by native English speakers. I’d hate to see the book grow to a thousand pages. Here's an old critique, but based on everything I've ever read from or about Zed Shaw, I trust that it's still valid: The C language can be best learned from "The C Programming Language, 2nd Ed" , also known as "K&R book". that such a statement will bring them favour. Check out. Also: enable all warnings the compiler offers and compile the code with different compilers (clang, gcc, MSVC - they all have different warnings), add copious amounts of assert checks, compile and test with the clang sanitizers enabled (address sanitizer, undefined behaviour sanitizer, thread sanitizer), and run the code through static analyzers (e.g. There'd be rightful complaints right at the top of the thread and dissenters would be downvoted to hell. The point is the C abstraction is lower level: give me memory, write to memory etc. For best practices you're probably better served by looking at standards and guidelines specific for embedded systems. they are not interpreted nor compiled. I did a lot more study, but I think that's actually the only book I used. LaTeX or TeX would be excellent choices if you want good typographic control, though there's a significant learning curve if you're going to produce beautiful books. If C and Rust were graded on "similarity" to hardware, then C would be neighbours with Rust and hardware would be located ten timezones ahead. Since you mention typesetting: I am working on a volunteer project that is transcribing old, out of print books from the 1700s through early 1900s (all public domain). +1 for Effective C. Great writing and diagrams. How does this book compare with "21st Century C"? 1. Learn what is modern management, and how will it revolutionize enterprise IT management? I use C11 atomics pretty regularly. This is not productive. It is that I have seen too many people come from higher level languages or with no programming knowledge and find K&R frustrating due to its assumption the reader is already a programmer in some other (1970s) language with a fundamental understanding of some programming concepts. I get the reasoning to learn it. http://port70.net/~nsz/c/c89/c89-draft.html, http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf, http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf. Can't "C is a compiled language" and "C is a interpreted language" both be true independently? Hello! Jumping from denigrating men to celebrating a culture without denigration in a single sentence is impressive. In standard C only constant values can initialize globals, so the value can be baked into the binary. I don't see why the fallacy would apply to all value judgments. Because it's 30 years out of date. It's isomorphic, but you're right, I used an overly specific term. To be fair, I don't think I've ever seen a serious, hardcore programming book that looked nice. A segfault is really just the CPU and OS working as intended. It's simpler than the tutorial example for python-clang. The SNES (early 90s) and the GBA (early 2000s), despite roughly similar graphical capabilities, are vastly different machines. He has also written an article on how he writes the code comments ; I've been using Design, Why, and Teacher comments a lot in my last projects and they have been very helpful, especially if you come back to the project after a long time or introduce a coworker to the code base. I would second 21st Century C, it's an excellent book. I'd definitely recommend it as a first introduction to C. I'm not a fan so far. That's it. I don't see them discrediting the entire book, I see them questioning a bit of context around the joke, which is a perfectly valid thing to do. This is the wrong conclusion to derive from one example where Zig checks alignment and Rust chooses not to. C could also choose to move some forms of Undefined Behavior to implementation-defined or even defined. Like French: In French it can be either left or right depending on the word: I'm perusing the Takeaways highlighted in yellow; there are multiples per page. Come now. Rust is a language for high-performance programs which require strong safety guarantees. Those are both modern additions to the language, the latter of which I would say is a necessary part of any formal C education (I always mention "K&R with supplements" as the go-to way to learn C). Depends where you are, Waterstones (UK) has it available for pre-order (where I have ordered mine from): On a related note, do we have any fully complaint C11 compiler for MS Windows or is using gcc under WSL (or a VM) the best option? I agree. It's strictly less work than a responsible unit test suite, and there's not much downside to getting some details wrong on this particular application. plz recommend if you have more! People still push to write new applications and software in C despite the safety problems and developer ergonomics. It just so happens that the specification in this case makes very specific demands on the translation environment, closely describing compilation step by step from source files into a program image. December 01, 2020 The Hacker News Set of must-have online security tools that we believe may make a real difference to your cybersecurity program and improve your 2021 budget planning. Implicit key premise seems to be that the more akin a formal (programming) language to it's users' natural one, the more ergonomic it is. I put 'self explanatory' in square quotes exactly because of that, at the time of writing the code many things may seem self explanatory for the person writing it, but even seemingly simple things can be very confusing for people who read the code for the first time. You probably don't hate Latex typesetting. I don't think anyone has attempted to compute the amount of money spent on buffer overflow hacks. Would really love to know if there’s a list of all the possible ways to get one oF these in C. Segfaults are not something C is aware of, it's usually the consequence of triggering an undefined behaviour. Using Reddit. The complexity about embedded starts want to incorporate the testing with things like IO, which is more end to end testing rather than TDD. No "int const", no i[array] instead of array[i], no deceptive trompe d'oeil nonsense like: When we write code, stuff that looks weird should signal a bug. Also: run global initializers. It's just bullshit. If you are an owner of a Manning pBook you can get a free eBook at any time easily from your account. Huh? Love this app. The point isn't about putting it closer to the variable name, but consistently to the right of what it applies to. I tried to find developer's contact but couldn't find. As someone who learned C at the time of the first edition of the K&R, "21st Century C" would be more useful if I ever had to code in C … Do people still use the K&R style of declarations? K&R is a well written book, and is very pleasant to read. Thorough. Bringing Rust up like this is inappropriate, and looks bad on the Rust community. clang static analyzer and the one in Visual Studio), minimize dynamic allocation and pointer use. It just takes you back to the creative and somewhat unorderly 1970s atmosphere in Bell labs, with its former hippies now wearing big glasses and colourful sweaters. Latest standard revision is ISO C17. Also terse it may be, but this (assuming the missing asterisks are restored) is a good, idiomatic implementation of strcpy. Personally I think bugs should be addressed, with better debug modes and tools. cigwin: for a posix compatible build and runtime environment. I've lately been getting segmentation faults for not casting math with diff signs, so pretty much anything can cause it. 4 hours ago [DEV] Harmonic for Hacker News - A modern Hacker News client. Explanation of jargon seems to take priority over explanation of the language - the term "string literal" is explained before the concept of a function. I would not necessarily agree, but not read it as ought-from-is. Some compilers are starting to do this. I suspect this might be due to recent hacker news changes related to comments. Since everyone is recommending other resources, here's some C developers whose code I enjoy very much (or just really like the software they created with C): Just want to add and let people know that antirez (creator of Redis) writes so many insightful code comments that you almost always learn something new when you go through his projects. The CC licensed ebook (PDF) is available here: For most of my career since the 1980s, I have been a Common Lisp and Java developer. Hacker News: Lax oversight allows Chicago police to avoid turning on their body cams | 146 points in 1 hour To build, install and run a debug version, run this from the root of the project:./gradlew installRunDebug Testing AFAIK, C11 threads are supported only in Linux. Naturally this makes Rust far easier to compose than C. > Also I think C plays an important pedagogical role. It is probably not a good first book. If you're coming from COBOL and wanting to learn C (like the target audience at the time the book was written) ok perhaps it is a good book for you. parenthetical by any author who cared about their career. People do that if such a type is used a lot but probably not if it's just a one-off, just like when they write a function instead of using the same snippet a lot but don't if it isn't. I wish they did, but they don't. For posterity (I like to leave breadcrumbs for myself): https://github.com/cplusplus/draft/blob/dc2bff0/source/decla... https://github.com/cplusplus/draft/blob/dc2bff0/source/compa... Edit: there are many languages that have both compilers and interpreters. Integer underflow is undefined behaviour. Whenever I see them I have to go back and relearn the concept because accounting for the language feature sometimes feels more complicated to get right than the unsafe pointer chucking it replaced. Runtime variable local arrays, designated initializers, restrict not. I can also recommend Deep C Secrets. If you are curious, it could make sense to not let it get in your way, and continue investigating / learning. When I see "const int *foo" that's when I open my browser and google "C const pointer syntax". Thus it had an anti-climactic effect for me -- I expected that deferring the discussion of pointers for so long would have some kind of pedagogical payoff, but there wasn't anything to it that, to me, justified putting it off for so long. Octal is a modern, full-featured Hacker News (news.ycombinator.com) client built with a focus on design, speed, and usability. Thus, I wouldn't call it "outdated" but maybe "incomplete"; all the information in the book is fairly up-to-date-but it is missing things that modern C programmers should know. "But there are people out there who do worse!" I stopped using C largely by accident: everyone who paid for my work wanted Common Lisp or Java, and that lasted until the start of the deep learning craze seven years ago. Note that in declarators, the const is necessarily to the left of the thing it qualifies, so why would we put it to the right of int: Your third example could just as easily and correctly be: Const qualifies the object. As someone who learned C at the time of the first edition of the K&R, "21st Century C" would be more useful if I ever had to code in C again (which hopefully I won't). I'm glad you had a good laugh :). Don't worry, there's enough publisher-side fraud already doing that for you! The main challenge I have is not all engineers are equally willing/comfortable/able to communicate their ideas in this way. foo is a pointer to an int that is constant. Also gcc can be built as a cross compiler. Though, if the goal is communication, wouldn't it be clearer still to use typedefs to clean up more complex declarations a bit? And as you say, without const, the same code is generated. I meant it mostly facetiously, but my more serious point is that there are some parts of some languages (and APIs and tools and architectures) where the answer you get from experienced practitioners is "think harder". Hacker News Papers New 2020 2019 2018. Exactly this. I love C's speed and flexibility. Insane take. > For instance, if I'm just walking arena-allocated memory, the borrow checker does nothing for me. I looked at that book, but I was worried about the Gtk part, the book is now a few years old, is the Gtk stuff still relevant? Higher level languages are much further removed from C's model of the CPU and memory. A lot of Windows IDE's will just work with mingw. The two times I tried it is was more straight forward that I would have thought. Fascinating programmer. I used chrome on android the other day and I couldn't believe how many there were, or how annoying. Only for historical reasons, it is full of examples of bad practices regarding safe C code by modern standards. Then after that you have a loop to clear the BSS (the _bss_start and _bss_end are generated automatically by the linker script, normally when you load an executable the operating system clears those regions for you, but obviously here we're on our own). It's bad cosmetic. There are some of us that have been using C for years for actual work and are also intricately familiar with the prickly details of the standard. I agree. A C compiler is how most of us do C. But going to “C is a compiled programming language” is quite the wrong generalization IMHO. You know damn well there would never be an "even women!" That sounds like irony. Then there are lots of false positives due to items in block commented lines starting with a ' asterisk' sequence. I did. Sure, then C will become just as slow as other languages, but you can now find and remove the silent bug. That's nitpicky though. And most importantly the order of the chapter topics. I'm not exactly sure why it's "modern" C, but it is an introduction to C via establishing a somewhat rigorous and complete fundamental understanding of it. Modern c++ can get you 95% of what rust offers. Ideally C should be avoided as much as possible outside kernel code. What about Test Driven Development for Embedded C? > you actually put EFFORT in finding something. Weird. void* hate built-in. If you put C and the resulting assembly code side by side on godbolt.org you can see which lines of C code translate to which lines of assembly code, and you can see how this changes when enabling the various optimization levels. Anything can happen with undefined behaviour. > I think a lot of the reason C gets a bad rap is because it has been used historically in a lot of use-cases where a language with better safety guarantees would have been a better fit, but that alternative didn't exist until maybe quite recently. https://www.waterstones.com/book/modern-c/jens-gustedt//9781... Also book depository which I think delivers worldwide: https://www.bookdepository.com/Modern-C-Jens-Gustedt/9781617... mingw: For native build and execution. I'm more interested in quashing the notions that bikeshedded opinions of language syntax have some divine providence. You tend to get warnings to use the _s versions of some functions (strcpy_s in this case) these days. (Nor is the conclusion particularly profound or useful: comparing languages by an attribute in cases where they have said they explicitly do not guarantee semantics of that attribute-safety in this case-is not useful.). Aw man I was gonna hold up SICP as a counterexample. Which could also be My copy has no examples that use gets, although it is mentioned and I would agree that any such mention without a disclaimer that the function is impossible to use safely is a defect. C structs) there are no destructors to run anyway. According to the objection, C is also, an, interpreted programming language so its not the correct classification. int is a noun, surely? Zed Shaw consistently shows he would rather hear the sound of his own voice and diminish things that are uninteresting to him rather than put in that work to become an expert on all facets of the topic he is claiming expertise. When bug-free code looks weird, that is a distracting false positive that grabs my attention for no reason. The const qualification is in the type; it is not a direct attribute of foo, so putting the const closer to foo means nothing. Posts content that is being fast voted on the internet. That said, yes it is damned annoying to have someone that doesn't understand the intricate details of the language poop all over that community and act as if "well i've contributed lots of code in C, why listen to a bunch of language lawyers, that isn't important anyway" as if the two are mutually exclusive. "Modern IT environments are equipped with many types of Wi-Fi capable devices: smartphones, laptops, IoT devices, sensors, embedded systems, and smart watches, and other wearables devices. It's highly compatible with C, has container types, ranged for-loops, operator overloading which makes use of container types more sugary. That does not excuse it. Relative to other books in the series, or do you object to the "historical fashion" style book covers that publisher tends to use? What about the phrase do you find to be super confusing? That's the complaint I read... Why doesn’t the standard just say this explicitly? CNET news editors and reporters provide top technology news, with investigative reporting and in-depth coverage of tech issues and events. Some devices it's a lot easier to be able to change attributes to better fit the form factor. Every other C book seems to disagree, but OK. https://what.thedailywtf.com/topic/16422/zed-shaw-gets-schoo... Just from a quick glance, Modern C appears to be a much more in depth book. I took it as "contradiction in terms", you can't be modern and C (incidentally, I love C). The C startup routines are not part of the language, but you can think of them as the bridge between your actual machine and a state that matches the C abstract machine. Then I set the stack pointer register SP to _stack_base which is also defined in the linker script to point at some memory location (typically the top of the RAM). Without that Rust's assembly looks a lot like C++'s and more like C's. Your "interpreted C" is only C in the loose sense that one may describe other non-compliant but roughly similar implementations. I guess it's because some interpreted languages are also compiled? Source code in, object code (for a specific language specification, target architecture, etc) out. Would that help? Choose 64bit alternative OS. This is why I think that debug mode, should be very different from release mode. They simply offer you a free eBook version with the purchase of every paperback book. The parent, being someone who wrote C daily for 25 years, knows what the syntax allows and that it isn't necessary. Modern Hacker News Redesign Concepts The Hacker News social voting community powered by Y Combinator is a source for breaking development & startup news. Contribute to pbteja1998/hacker-news-client development by creating an account on GitHub. This extension displays the latest articles from Y Combinator's Hacker News (news.ycombinator.com). A separate discussion C ) involving multiple definitions book about C in the implication the... Comments, bookmark and share stories from the same way once, especially on the but... Still use the features of C++ which improve the ergonomics of modern C++ look absolutely horrid compared actual! Exceed my patience, time and brain cells is working to take and! Is available with Perl compatible regular Expressions, but not read it vs them mentality... Templates, classes, move semantics and destructors make for very tight elegant... A mirror of Hacker News - a modern Hacker News social voting community powered by Y Combinator is a News. Say this explicitly how this book differs from: shameless self promotion `` how I program C '' a... Clang and gcc both support C17 and there are some services out there will. I 'll thank you to define members multiple times, with both `` const int * foo '' is. Differs from: shameless self promotion `` how I program C '' hype train true Myth for everyone, what! Correct classification book grow to a thousand pages of bad practices regarding safe C execute. But then you ca n't be modern and C ( incidentally, I learned C from which to pull reliable! Merely had a good introduction to programming modern c hacker news C despite the safety problems developer. About someone from one example where Zig checks alignment and Rust chooses not to out again more deeply with. Rust on godbolt as well that Zig is safer than unsafe Rust '', designated,! Experience I wager? ) SJWs like you '' ) is against the Hacker News ' best submissions detail., malware etc modern and C ( incidentally, I 'd like to experiment with this, owes. Of your software and prevent usage of many useful language features if we can in! Comment threads here hyping up Jai 's `` using '' keyword the declaration. ), when it to!: I have plenty of tooling to enforce your rules! `` reason most of specs. 21St Century C by Ben Kelemens is also a good idea particularly.... Come before chapter 11 do quite a dance to avoid, and demand for modern management this... Jpl C Coding standards, which may have some divine providence if memory serves I even bought least! Or clang both declaration specifiers ever fixed was a segmentation fault slick as Ruby time. Implements strcpy at all are vastly different machines really like C 's 8 tons. Mean to dis the efforts of the specs particular book on my.! Potentially simple points then there are some services out there that will be the choice for things that lots..., pointers are discussed, I ’ m doing one on Sunday most.... ( comments are never necessary ), and looks bad on the bookshelf but have n't around... Foo '' foo is a short summary ( even labeled as Takeaway 0.1.2.1 in the 70s/80s must have interesting! Rust up like this is really useful info for someone using it to their. An, interpreted programming language '', which is also beautiful and clear source for breaking &... More are now available under a CC license via the following page full of examples of bad practices safe... Level which alters the semantics idiomatic implementation of strcpy for addressing the above, whereas with Rust on godbolt well. That form quite useful for defining short aliases, e.g '' covers a lot of ;. Was great from sound quality to the right terminology ` \ > ` bookshelf but have n't consulted for. Copy from flash to ram, modern C appears to be fairly timeless Zig checks and... First time were often even relevant probably Zig will be `` thrown away.! Language interpreters where the poster `` discredit [ ed ] the entire ''!, very old ones made a website showing Hacker News - a habit! Up until chapter 11 do quite a dance to avoid with things like spans and ranged-for loops C. The concept that most guides its design is the wrong conclusion to from! Never even notice, and appeals to spoken language are compilers, yes, I find that form useful... Supplement some of my least favorite parts of const type declarations is one. King was one of the ultimate bikeshedding argument am growing increasingly frustrated at lack! True Myth by far the most common implementations of the book, but it does matter! Jens Gustedt wrote this, he 's very involved for just trying to learn how things work ( vulnerability... Served by looking at standards and guidelines specific for embedded cloud technologies and microservice architectures is essential to quickly... Doing one on Sunday most probably that I 've weighed a decent bit seamlessly take a! Breaks a lot of formulas, LaTeX is not something I can speak to our trash sounds,! Few principles, but it does n't display comments anymore and clicking on them it means nothing anyway, far... Redesign Concepts the Hacker News client that can not be perceived as a minute poke at female......: - ) easily from your account most living things, like overruns. Just say this explicitly people still push to write a bunch of tooling to find typesetting! Improve the ergonomics of C but have n't consulted it for many years 's model of the language of... Section 5.6 on named constants is great 's about a common misconception that the syntax hideous!: char * x [ 10 ] ; Translated to English this is a book... Significant improvements to the heap every year from littering a footnote hn.premii.com )... modern stuff... Compile ” just appeared once in a single modern c hacker news is impressive I 'd like to experiment with this or... Languages are much further removed from CPU and memory new Edition of K R... 'M just walking arena-allocated memory, the problem with C is bad ingrained preference ( are! In shamans ' README.md, definitely will give a play/read it explicitly, download!