News for hackers. Stuff that matters.
Re:Where to begin when learning C? Start by making lots of e... by tptacek on Saturday November 16, 2013 @10:06AM (#6744969)
This situation is why there is "hello world"; that program seems trivial but actually has important implications; for instance, that your environment works, that you know how to feed programs to the compiler, that you can actually run the output.

I never took "hello world" seriously until I started doing embedded systems work; it's now an extraordinarily important tool for me (I work an anomalously weird number of different environments).

Re:Where to begin when learning C? Start by making lots of e... by mrmekon on Saturday November 16, 2013 @10:41AM (#6745091)
I once had a particularly slow week at work, and decided to write an article about how "Hello World" works in C. How it really works -- including compiling, linking, system calls, operating system involvement, hardware I/O, communication between ICs, etc. The path from the block of text to photons emitting from the screen, with fairly detailed explanations at every level.

I ended up with a 50 page LaTeX document that barely even scratched the surface, and then work picked up and I never finished it. A "full" explanation would probably be a 600+ page book.

I still think it would be a neat resource to have. We kind of take for granted that the simple "Hello World" is built on 60 years of research, and is anything but simple.

Re:Where to begin when learning C? Start by making lots of e... by Aeolus98 on Saturday November 16, 2013 @11:06AM (#6745181)
I second the motion to post the unfinished guide! Perhaps on Github where some other HN guys can make it complete for you.

Regardless, I think it's a great idea, and would really give insight as to why things work the way they do, instead of us just seeing Hello World!

Re:Where to begin when learning C? Start by making lots of e... by waterlesscloud on Saturday November 16, 2013 @11:09AM (#6745196)
Posting it on Github is a fantastic idea.
Re:Where to begin when learning C? Start by making lots of e... by eliben on Saturday November 16, 2013 @05:01PM (#6746611)
My (admittedly, considerably more humble) attempt is http://eli.thegreenplace.net/2012/08/13/how-statically-linke...

It takes on an even simpler program, namely:

  int main() {
      return 42;
  }
But digs in the C runtime, Linux kernel and touches on compilers, linkers and loaders.

Hope it's helpful

Re:Where to begin when learning C? Start by making lots of e... by oftenwrong on Saturday November 16, 2013 @01:18PM (#6745790)
I have been looking for a guide like that. I would also appreciate a release of the unfinished version.
Re:Where to begin when learning C? Start by making lots of e... by joshvm on Saturday November 16, 2013 @03:55PM (#6746392)
Some resources on making tiny Hello World programs down to the kernel level that may be useful:

https://blogs.oracle.com/ksplice/entry/hello_from_a_libc_fre...

http://www.muppetlabs.com/~breadbox/software/tiny/teensy.htm...

http://timelessname.com/elfbin/

A wee bit heavy, but it's comprehensive. It deals with what happens when you run code, how the architecture of the computer works (by and large) including at the logic level:

http://www.amazon.co.uk/Computer-Systems-Programmers-Randal-...

If you want to go lower (and higher).. look at Understanding the Linux kernel for a good understanding of how an OS is put together, with specific examples i.e. Linux.

Code, by Petzold, deals with logic and computers from the ground up. It starts with relays and builds them up into gates and usable arithmetic blocks.

http://www.amazon.co.uk/Code-Language-Computer-Hardware-Soft...

http://www.amazon.co.uk/Understanding-Linux-Kernel-Daniel-Bo...

The physics is fairly simple, at least from a CRT or LED display perspective. Gets more tricky dealing with interconnecting microprocessors because a good chunk is vendor specific.

I think this kind of project is well suited to a guide on how to build a computer from the ground up, starting with logic gates, writing a real time OS and developing a scripting language that will run and compile on it. Then you can skip a lot of largely extraneous stuff and have a solid understanding of how the hardware works.

Re:Where to begin when learning C? Start by making lots of e... by sanoli on Saturday November 16, 2013 @05:59PM (#6746743)
This book and its companion (free) online course are great: http://mitpress.mit.edu/books/elements-computing-systems http://www.nand2tetris.org
Re:Where to begin when learning C? Start by making lots of e... by pjmlp on Sunday November 17, 2013 @03:53AM (#6748138)
Very good indeed. The Google Tech-Talk presentation is worth watching.
Re:Where to begin when learning C? Start by making lots of e... by morganwilde on Saturday November 16, 2013 @10:46AM (#6745110)
WOW, you should post that LaTeX document regardless of it being unfinished! Just the fact that you spent so much effort, requires some sort of release :)
Re:Where to begin when learning C? Start by making lots of e... by jaredandrews on Saturday November 16, 2013 @11:07AM (#6745188)
This is the sort of thing I was looking for when I started wanting to understand the 'big picture' of computer programming. Would be great if you posted it!
Re:Where to begin when learning C? Start by making lots of e... by wglb on Saturday November 16, 2013 @10:48AM (#6745116)
I have often had the same idea, but more towards the goal of the intended audience being non-programmers.

But if you do finish this, I certainly would be interested in reading it.

Re:Where to begin when learning C? Start by making lots of e... by purringmeow on Saturday November 16, 2013 @10:52AM (#6745125)
Can you please post it somewhere? I am really curious!
Re:Where to begin when learning C? Start by making lots of e... by joshavant on Saturday November 16, 2013 @01:43PM (#6745908)
This sounds like an outstanding Kickstarter project.
Re:Where to begin when learning C? Start by making lots of e... by rhgraysonii on Sunday November 17, 2013 @12:09AM (#6747685)
Please, please post this. Or if not would you be willing to share it privately? This is the sort of reading that really gets my rocks off. My email is in my profile if you're interested at all. I really would love to see this.
Re:Where to begin when learning C? Start by making lots of e... by chimeracoder on Saturday November 16, 2013 @05:15PM (#6746646)
> How it really works -- including compiling, linking, system calls, operating system involvement, hardware I/O, communication between ICs, etc. The path from the block of text to photons emitting from the screen, with fairly detailed explanations at every level.

That reminds me of JBQ's blog post from shortly after Dennis Ritchie's death: https://plus.google.com/112218872649456413744/posts/dfydM2Cn...

I would love to see that document if you still have it.

Re:Where to begin when learning C? Start by making lots of e... by bitwize on Saturday November 16, 2013 @04:50PM (#6746579)
Agreed. "Hello world" is how you test that you are able to create a particular software artifact at the most basic level. My first kernel device driver was a NetBSD one called /dev/hello; it simply spit out "HELLO WORLD " over and over, for as long as you cared to read it. But it showed me how drivers do I/O and that I could write one and link it in.
Re:Where to begin when learning C? Start by making lots of e... by neckbeard on Saturday November 16, 2013 @05:58PM (#6746738)
Another important outcome of a successful "hello, world!" is that you find some kind of MVP - Minimal Viable Printf.

Just because it is C doesn't mean you've got a sane libc. Let alone the luxury of a debugger. Just seeing that simple string on the screen/logfile can be a blessed relief.