https://www.phoronix.com/news/GNU-C-Language-Manual
GNU founder Richard Stallman has recently been working on crafting a GNU C Language introduction and reference manual.
Stallman announced today the release of the GNU C Language Introduction & Reference Manual for covering the GNU extensions to the C programming language.
The manual is written as Texi files and is published under the GNU Free Documentation License, v1.3+.
- This manual explains the C language for use with the GNU Compiler Collection (GCC) on the GNU/Linux system and other systems. We refer to this dialect as GNU C. If you already know C, you can use this as a reference manual.
- If you understand basic concepts of programming but know nothing about C, you can read this manual sequentially from the beginning to learn the C language.
- If you are a beginner to programming, we recommend you first learn a language with automatic garbage collection and no explicit pointers, rather than starting with C. Good choices include Lisp, Scheme, Python and Java. C's explicit pointers mean that programmers must be careful to avoid certain kinds of errors.
This discussion was created by janrinok (52) for logged-in users only, but now has been archived.
No new comments can be posted.
Richard Stallman Announces GNU C Language Reference Manual
|
Log In/Create an Account
| Top
| 20 comments
| Search Discussion
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
(1)
(Score: 0, Offtopic) by Anonymous Coward on Thursday September 08 2022, @06:54PM (1 child)
"If you are a beginner to programming, we recommend you first learn a language with automatic garbage collection"
Then it isn't C any more, is it?
(Score: 2) by dwilson on Thursday September 08 2022, @09:03PM
No, and it doesn't claim that it is.
What point were you making?
- D
(Score: 5, Informative) by RamiK on Thursday September 08 2022, @07:34PM (4 children)
I don't have a TeX build env to compile the git clone but this copy I googled [cyberciti.biz] shows the book has pretty decent coverage and structure. The parts about floating point math, complex numbers and so on especially stand out since most books really botch this topic.
compiling...
(Score: 2, Disagree) by krishnoid on Thursday September 08 2022, @07:43PM (1 child)
TeX is so long in the tooth that you'd figure there should be a JavaScript or other online implementation available.
(Score: 3, Informative) by RamiK on Friday September 09 2022, @10:11AM
LuaTeX works around a lot of the old issues but it's quite hackish so it's hard not to recommend Sile [sile-typesetter.org] now that it has a math package and hit full feature parity with LaTeX... Regardless, mathjax does a decent job at displaying math in the browser using TeX syntax but running any typesetting stack involves hundreds of MBs of assets regardless so client-side typesetting are best left out of the browser.
compiling...
(Score: 1, Troll) by driverless on Friday September 09 2022, @11:00AM (1 child)
Ugh. The problem with anything typeset in TeX is that it looks like a 1980s maths paper. That, combined with the layout and writing style, makes it read like a somewhat incoherent 1980s maths paper.
I mean, I applaud the effort and everything, but you'd have to be really keen to plough through this lot.
(Score: 2) by RamiK on Friday September 09 2022, @02:49PM
Short of some of the limitation LuaTeX and SILE resolve (mostly grids and alternative line-breaking algorithms), it's all just defaults that you can override to output just about anything you'd like.
Since I already know C I didn't sit to read through it cover-to-cover but only jumped through some topics, reading page or 2 long sections per the reference manual use case. But, in the places I've looked, I didn't really notice any incoherence... As for the style feeling dated, not sure? I mean, the Fibonacci intro definitely has ol' school feel to it but beyond that it all felt pretty practical and on point. But again, I've only looked at specific sections so it's possible there's some long paragraphs of math major ramblings I missed...
compiling...
(Score: 5, Interesting) by Snotnose on Thursday September 08 2022, @08:43PM (9 children)
C's pointers were "um, this is hard exactly why?" to me. I'd been dealing with indirect address references via z80 and 8086 assembly for years.
I remember an interview I had close to 30 years ago with John Rogers, of Comic Con fame but he worked at Qualcomm. One of his first questions was to reverse a string. I put a pointer p1 at the front and p++. Put p2 at the end and did p--; Swapped the values until p1 and p2 crossed. We spent a good 30 minutes on me convincing him my way worked.
That said, over 40 years it was not unusual for me to understand pointers better than the guy (yeah, always a guy) asking the question.
/ RIP John, you were a great boss
// wrong website, slashies aren't grokked here
Of course I'm against DEI. Donald, Eric, and Ivanka.
(Score: 2) by progo on Thursday September 08 2022, @10:12PM
I barely know any C, but your interview question response sounds like the most expedient solution. Maybe advanced webshit developers such as myself have broader understanding of everything than his role would have at the time. It's a good sign that he was willing to discuss it and learn to understand your solution.
(Score: 1, Interesting) by Anonymous Coward on Thursday September 08 2022, @10:27PM (3 children)
What was the official way? It bugs me that you have to waste cycles finding the length of the string first no matter what. A good function should have the length as a parameter in case those cycles have already been run. I'm given to understand C's choice of NUL term'd strings was due to the difficulty of passing around a struct with a pointer and a length on some early hardware, but AFAIK that's what Pascal did and it didn't come out much later. We've been paying the price for that a long time.
(Score: 4, Informative) by vux984 on Thursday September 08 2022, @11:19PM (2 children)
If i recall correctly, Pascal strings were prefixed with the length (e.g. instead of the byte at the zero offset from the start of the string containing the first character, it contained the length of the string).
(Score: 3, Insightful) by optotronic on Friday September 09 2022, @01:58AM
That was very convenient because Pascal strings were indexed from "1". However it meant strings could only be 255 characters long. But, they could contain nulls.
(Score: 2) by hendrikboom on Saturday September 10 2022, @02:43AM
Pascal strings were all fixed-length. But you could declare the length of each string, using a constant integer for the length.
(Score: 5, Interesting) by vux984 on Thursday September 08 2022, @11:11PM
C pointers were never that difficult. object lifecycle management however is a nontrivial subject. (even in C without so-called objects where you use malloc/free (or whatever alternative).
Yeah, but did you triple xor them so you didn't need to find a place to hold the swap?! ;)
In any case your solution is ok for an in-place reversal, and quite performant too -- but is not a functional solution (in the sense of functional programming); and 30 years ago you probably weren't dealing with UTF character encodings which also wouldn't work with your algorithm.
(Score: 4, Interesting) by corey on Thursday September 08 2022, @11:33PM
I didn’t have a problem understanding pointers but I did have trouble remembering the nomenclature. Like the use of &var and *var. Was var the pointer or the value, for example. It got me for ages and I had to really practise it with difficulty to remember it.
This reference manual is great timing for me. I’ve been working on a Modbus sniffer in C and have found online reference websites lacking (but not for C++).
(Score: 2) by DannyB on Friday September 09 2022, @03:34PM (1 child)
Nice solution.
Being a Java guy, I would ask: are p1 and p2 pointers or are they indexes?
When strings have a defined length, are not bounded by a special terminating character, thus allowing the string to hold all characters as part of its content, then setting p2 is very efficient. p2 = length - 1. p1 = 0.
The server will be down for replacement of vacuum tubes, belts, worn parts and lubrication of gears and bearings.
(Score: 2) by vux984 on Friday September 09 2022, @05:25PM
Technically, in this case pointers, but really its just semantics. An index is just an offset from a pointer.
Suppose string S is 15 bytes in memory starting at memory offset 500.
p1 is 500, p2 is 514.
But in C strings are char* (pointers to characters). So string S is really a char* equal to 500. (ie same as the inital pointer p1), and *s is the first character in the string (the character at memory location 500).
You could have just as easily done it with indices though:
instead of setting p1 = 500, and p2 = 514, you could set p1 = 0, p2 = 14 and then run exactly the same algorithm:
and then swap s[p1++] with s[p2--], where p1 and p2 are indices; or equivalently do it with pointer arithmetric instead and swap the contents of *(s+p1++) and *(s+p2--)
Technically, to convert from an index to a pointer offset you'd also need to multiply by sizeof(T) too, e.g. *(s+sizeof(char)*p1++), but since sizeof(char) is 1 in the applicable case...
(Score: 2, Insightful) by Anonymous Coward on Thursday September 08 2022, @10:19PM
It seems like anybody interested in this topic would have taught themselves C years ago and found documentation on the GNU extensions from many 3rd party sources. This seems like a chrome bumper add-on for the car you finally got from the USSR after being on a waiting list for 30 years.
(Score: 2) by dltaylor on Friday September 09 2022, @12:17AM
There are only two features of gcc that I ever found useful enough to break out of pure K&R: assembly statements inline and "reg" modifier for variables..
I wrote a complete 68K boot engine for an embedded system in "C" with only two asm statements. One of them put a label in the boot function after the the not yet initialized stack usage of normal function entry, and the other set the stack pointer so other function calls were possible. The boot engine had to figure out the RAM size because we had multiple memory sizes available and the stack pointer was initialized to the highest address. There was an optional feature to run a full memory verification. For production test, an otherwise-unused address was used to write progress checkpoints which could be traced on a logic analyzer. A COFF reader would locate user applications and call them if found.
(Score: 5, Insightful) by lentilla on Friday September 09 2022, @12:26PM
Oh, Dr Stallman, would it have killed you to provide versions in HTML and PDFs in A4 and letter sizes in your repository?
I am in the likely 0.001% of humanity than could walk to my development system, clone the repository and build the documents without undue hassle. What about the rest of us... it would have been so easy...