Live data from Hacker News

Brushing up on operating systems and C programming

shubhro.com

51–60 of 89 posts

Re: Brushing up on operating systems and C programming

#51
post #5

Can anyone recommend an intermediate to advanced C book? I feel like most C material I've been exposed to in the past lacks what a modern C project should have when it comes to best practices, code organization, build tools (should I use make for this, cmake, where does autotools fit? what about clang vs gcc?), linters (valgrind?), testing, etc. I recognize that much of this falls outside of C, but all of these tools…

To answer your questions: * Clang vs gcc: doesn't really matter. Clang has slightly better compile times. GCC has really advanced but in some cases still has inferior warning/error messages. Best practice is not to really use GNU c features unless you want to. If you do want to, decide if you want to just use the subset supported by clang or the full shabang from gcc. Beyond that: if you want to support both, test on…

> Uninitialized values and out-of-bounds memory accesses are significantly more important and worrisome than memory leaks (because they represent potential attack vectors)

I agree with your conclusion but not your reasoning. Attack vectors are way down the list of reasons why uninitialised values and out of bounds memory accesses are higher priority. They're higher priority because they will likely (maybe definitely) crash your program or (even worse) cause it to fail in a frustratingly indeterminate manner. You should be so lucky that your program becomes significant enough to be targetted by "attackers".

Re: Brushing up on operating systems and C programming

#52
post #24

Will recommending my own project get me hell-voted? Cixl is a straight forward 3-stage (parse/compile/eval) interpreter that is designed to be as fast as possible without compromising on simplicity, transparency and flexibility. The codebase has no external dependencies and is currently hovering around 7 kloc including tests and standard library. There are some articles explaining design decisions, but I've been most…

> contains plenty of good ideas distilled from 32 years of daily practice

Wow, okay im sold. And to think that i thought i was getting good after a few years.

Re: Brushing up on operating systems and C programming

#53

Earlier quoted context omitted.

To answer your questions: * Clang vs gcc: doesn't really matter. Clang has slightly better compile times. GCC has really advanced but in some cases still has inferior warning/error messages. Best practice is not to really use GNU c features unless you want to. If you do want to, decide if you want to just use the subset supported by clang or the full shabang from gcc. Beyond that: if you want to support both, test on…

> Uninitialized values and out-of-bounds memory accesses are significantly more important and worrisome than memory leaks (because they represent potential attack vectors) I agree with your conclusion but not your reasoning. Attack vectors are way down the list of reasons why uninitialised values and out of bounds memory accesses are higher priority. They're higher priority because they will likely (maybe definitely)…

Agree. One such simple example is a ListNode (Linked List). In C/C++ implementation, if we don’t explicitly declare

    node.next = null
It can have a garage unless you assigned a value.

This can be hard to debug in production.

Re: Brushing up on operating systems and C programming

#54
post #40

Somewhat unrelated but I've always wanted ask: What types of small projects can a beginner start to develop a better understanding of C ? (Beyond basic syntax, something that would actually make use of memory allocation, pointers etc)

A small kernel.

I think it’s always good to start with implementing data structure and algorithms...

If you want C++, try help out Firefox’s codebase. I did and it was a very rewarding experience. (Linux kernel project is hmm... just harder to get involved IMO).

Re: Brushing up on operating systems and C programming

#55

        ◾ "PROTOCOL SHIELDERS" ◾
Hello,

I am COREY RODRIGUEZ by name, THE CEO of protocol & cyber-sheild hackers. In this message, we will explain how you can almost avoid SCAMMERS and stay safe, plus how our organisation works.

Read it carefully!! Its reading will not take more than 10mins.

We kindly URGE you to not respond without have read the entire text. Those who mail without have read everything, ask questions that are answered here!!

WARNING: MOST HACKERS YOU SEE HERE ARE FAKES AND INCONGUROUS!!. It tears me up when we receive bitter emails for Jobs with complains from most clients with hacking issues about past SCAMs by uncertified fake hackers like most you see here, which is disappointingly inadequate, leaving their mess for us to deal with eventually (WE DON'T MEAN TO BRAG ABOUT THAT).

HOW WOULD YOU KNOW??

You won't know until you fall a Victim but can be attentive to potential danger, error or harm if you take note of these:

1, you see uncertified email accounts carrying numberings like "iamhacklord1232@(gmail,yahoo or hotmail.com" pls flee from them, BIG SCAMMERS. They take your money and never do your job!!

2, you see posts like "do you need to spy on spouse?" All fake! , just a way to lure you toward getting ripped OFF!.

3, posting fake testimonies and comments to trick you into feeling save and secured. Pls endeavour to ignore!!

     ◾VERY IMPORTANT◾
For years now, We've helped organisations secure data base, so many sites has been hacked for different reasons of Job kinds. "CLEAR CRIMINAL RECORDS" & "iPhone HACK" of and in short timing hacked petty cyber sites accounts like Skype, Fb, WhatsApp,Tinder,Twitter!!, FLIPPED MONEY, LOAD CCs and vice versa but these are significant experiences a good and effectively recognized organisation must firmly ascertain.

          ◾OUR  "AIMS" HERE◾
Are: 1◾to assign a qualified agent of specific rank to particularly any sort of cyber issues you intend dealing with in short and accurate timing.

2◾ to screen in real hackers (gurus only) in need of job with or without a degree, to speed up the availability of time given to for Job contracts.!!

Thus an online binary decoding exam will be set for those who seeks employment under the teams Establishment.

write us on: ◾Protocolhacks@gmail.com or ◾Cybershieldnotch@gmail.com ◾Cybershieldnotch@protonmail.com,

COREY ROD, SIGNED...! Thank you!!!

Re: Brushing up on operating systems and C programming

#56
post #40

Somewhat unrelated but I've always wanted ask: What types of small projects can a beginner start to develop a better understanding of C ? (Beyond basic syntax, something that would actually make use of memory allocation, pointers etc)

Creating a small UFS implementation (on top of your file system, rather than as a raw disk is probably easier) in C is a nice fun exercise.

Thanks for the recommendation ! Sounds indeed like a fun thing to do.

Re: Brushing up on operating systems and C programming

#57
post #54
post #40

Somewhat unrelated but I've always wanted ask: What types of small projects can a beginner start to develop a better understanding of C ? (Beyond basic syntax, something that would actually make use of memory allocation, pointers etc)

A small kernel. I think it’s always good to start with implementing data structure and algorithms... If you want C++, try help out Firefox’s codebase. I did and it was a very rewarding experience. (Linux kernel project is hmm... just harder to get involved IMO).

Ha ! Yeah I'm not competent enough yet to start this kind of project. It does seem really fun though

Re: Brushing up on operating systems and C programming

#58
post #40

Somewhat unrelated but I've always wanted ask: What types of small projects can a beginner start to develop a better understanding of C ? (Beyond basic syntax, something that would actually make use of memory allocation, pointers etc)

The best guided project/intro I've seen for complete beginners is Daniel Holden's "Build Your Own Lisp". It's a free online book that walks you through writing a Lisp interpreter (something worthwhile even for experienced C programmers!):

http://www.buildyourownlisp.com/

Re: Brushing up on operating systems and C programming

#59

Earlier quoted context omitted.

To answer your questions: * Clang vs gcc: doesn't really matter. Clang has slightly better compile times. GCC has really advanced but in some cases still has inferior warning/error messages. Best practice is not to really use GNU c features unless you want to. If you do want to, decide if you want to just use the subset supported by clang or the full shabang from gcc. Beyond that: if you want to support both, test on…

> Clang vs gcc: doesn't really matter. Clang seems to have better sanitizer support, which can be lighter weight initial passes before running valgrind.

What exactly is better wrt. to sanitizers with Clang?

Re: Brushing up on operating systems and C programming

#60
post #57
post #54

Earlier quoted context omitted.

A small kernel. I think it’s always good to start with implementing data structure and algorithms... If you want C++, try help out Firefox’s codebase. I did and it was a very rewarding experience. (Linux kernel project is hmm... just harder to get involved IMO).

Ha ! Yeah I'm not competent enough yet to start this kind of project. It does seem really fun though

Yeah... the suggestions here are all pretty cool but not for beginners.

I‘d suggest a simple Sudoku solver as a beginner project :)

Post reply on HN