News for hackers. Stuff that matters.
Re:Effective C: An Introduction to Professional C Programming by dvfjsdhgfv on Sunday March 29, 2020 @07:23AM (#22718079)
I'm sorry, $60? I'm all in favor of fair remuneration for an excellent piece of work, but this is really too much. $30 would be much more fair.

(And it doesn't matter if it's a physical book or e-book, the cost of printing nowadays is ca. $1 for each 100 pages.)

Re:Effective C: An Introduction to Professional C Programming by petee on Sunday March 29, 2020 @07:55AM (#22718243)
For 272 pages written by probably the best person to be writing modern C books, from a small publisher who is known for quality books, sixty dollars doesn't sound unreasonable at all
Re:Effective C: An Introduction to Professional C Programming by billpollock on Sunday March 29, 2020 @11:21AM (#22719695)
Thank you.

When our authors ask how long their book should be I always say: Long enough to cover the subject, short enough to keep it interesting. My company is called No Starch Press for a reason. Think of the word starch as a nicer way to say "BS", as in No BS Press.

There's a lot of work behind these pages as with all of our books. Unlike any publisher in this field we have several people who read and craft every line of every book as necessary, together with each author, before a book goes off to a copy editor. That's where most books start but not hours.

The real cost in creating a good book is not in the paper. It's in the time it takes to actually craft the words.

Re:Effective C: An Introduction to Professional C Programming by psychoslave on Monday March 30, 2020 @03:09AM (#22725845)
Would you be interested to launch translations of some of your books? I would love to make these technical books available in French and Esperanto.

I know the Rust book is already translated in some languages. I even started the Esperanto translation myself[1], but had other priorities in the mid time. Doing that in spare time doesn't help to accelerate the process, but I already achieved the translation of the Lua reference manual this way.

If you are interested, just send me an email through mathieu at culture-libre dot org, or reply to this message with some instruction on which canal you would prefer to use.

[1] https://github.com/psychoslave/Rust-libro [2] https://www.mediawiki.org/w/index.php?title=Extension:Scribu...

Re:Effective C: An Introduction to Professional C Programming by ghostpepper on Sunday March 29, 2020 @10:58AM (#22719509)
Not to be rude to the author but what makes him the best person to be writing modern C books?
Re:Effective C: An Introduction to Professional C Programming by rcseacord on Sunday March 29, 2020 @11:25AM (#22719732)
So it's hard to say that I'm the best person to write a modern C book. A slightly lower bar might be, am I the best person who has actually written a modern C Book?

Resume-wise, I've been writing C code since 1985, and I've been an expert on the C Standards Committee (WG14) since 2004. I've written two prior books on C Programming including "Secure Coding in C and C++" and "The CERT C Coding Standard". I also teach Secure Coding in C for NCC Group https://www.nccgroup.trust/us/our-services/cyber-security/se... and I also taught these topics to Computer Science undergraduates and graduate students at CMU for over a decade. So I think I have a good balance of technical skills and communications skills, but you know, pick up a copy and judge for yourself.

Re:Effective C: An Introduction to Professional C Programming by nrclark on Sunday March 29, 2020 @12:53PM (#22720480)
If I buy a copy of your book, will you abuse your position to get constexpr into C? It would be a big improvement over complex macro magic.

I'll buy an extra copy if you can get 'defer' in there too!

Those two features would really be the bee's knees :)

Re:Effective C: An Introduction to Professional C Programming by rseacord on Thursday April 02, 2020 @09:29AM (#22758697)
This is an interesting coincidence, because I just started drafting a 'defer' paper. In general, this is not an abuse of my position. I would be happy to collaborate with you (or anyone else in the community) to develop papers and champion them to the committee. They would have to be sensible ideas, which both of yours are too.
Re:Effective C: An Introduction to Professional C Programming by nrclark on Sunday April 12, 2020 @09:41PM (#22852353)
That's awesome!!! I'm actually really interested in the semantics of how a defer{} statement might work in C. If you have any kind of a draft or anything, I'd get a kick out of reading over it.

Re: developing a paper for constexpr, that's an interesting idea. I hadn't really thought about writing one up myself but it'd be an interesting thing to try out. Can you recommend a good example proposal that I could read? Shoot me an email at nicholas dot clark on the gmail if you ever see this.

Re:Effective C: An Introduction to Professional C Programming by rhexs on Sunday March 29, 2020 @01:36PM (#22720838)
If you're looking for a low-level performance targeted language where anyone can add anything whatsoever, I've got great news! C++ already exists!
Re:Effective C: An Introduction to Professional C Programming by nrclark on Sunday March 29, 2020 @09:12PM (#22724332)
I get your point. C is not C++, and it shouldn't get every feature under the sun.

But it's also not exactly -complete-. The standards committee makes changes every few years, including language additions.

I'm a fulltime C programmer, and I would _love_ to have both of the features I suggested - for the following reasons.

- defer: I could defer a free() statement after every malloc, guaranteeing that I won't miss one or forget about it. Lots of memory leaks and file-descriptor leaks could be easily avoided if C provided 'defer' as a language feature. GCC already offers something kind of similar with its __cleanup__ attribute, and a lot of programs rely on it. How much better would it be for the language to support it natively?

- constexpr: I am _so tired_ of writing really complex macros. Like say I want to populate a lookup table for a sine-wave (for fast use in a realtime system). Wouldn't it be nice if I could just populate my lookup table with a constexpr function? Then I wouldn't need really nasty macros, and I'd also be able to ensure that the calculations all happen at compile-time.

Re:Effective C: An Introduction to Professional C Programming by petee on Tuesday March 31, 2020 @11:37AM (#22738551)
I probably could have chose a different wording, but everything you've just said is exactly why I suggested it; C isn't a language just anyone should be writing about, especially when it comes to security
Re:Effective C: An Introduction to Professional C Programming by burfog on Monday March 30, 2020 @01:29AM (#22725499)
Oh, a standards committee member! We have requests...

Now that C allows mixing variable declarations in with statements, it becomes annoying that variable declarations can not have labels. This hits particularly hard with the switch/case, but can also apply with ordinary named labels. The syntax to work around this defect is ugly.

The gcc extension for case ranges is really valuable.

Setting the sign bit via a cast should not cause undefined behavior. (for example, going from uint32_t to int32_t) It should just work in the obvious way. Avoiding the problem requires extremely strange code.

I'd like a way to prevent arrays from being replaced by pointers. Assignment could work. Sometimes I really want to pass an array to a function, and I don't mind if that means a megabyte is copied into the function args on the stack. Sometimes I really want to force the huge copy, and other times I'd rather have the compiler keep it in the caller's frame (but callee can mangle it unless it is const) and just pretend that the callee got more than a pointer. Array dimensions need to survive. The callee's prototype should be able to demand specific dimensions or receive them as variables, and the caller should be able to pass a portion of a larger array

The default function parameters of C++ would be useful. The UNIX API for open() would be best done this way, allowing a prototype without the need for stdarg. There doesn't seem to be any reason why default parameters would have to be at the end; a pair of adjacent commas in the middle is a fine way to indicate that the default is to be used for that missing parameter.

It's time to standardize bitfield layout so that bitfields can be used in portable code for purposes like assemblers and disassemblers. (in other words, not for purposes like access to MMIO registers) Microsoft and GNU compilers are already quite compatible on x86_64, so that would be the basis of standardization.

When a bitfield happens to have the size and alignment of a normal integer type, it should be possible to take the address. The resulting type would be a pointer to the integer type of lowest rank having the correct size.

Anonymous unions and structs would be valuable in all scopes, including at file level. This would allow careful data organization to save space, improve cache locality, prevent undesired cache line aliasing, or allow the intentional aliasing of types. Current technology typically involves abuse of the linker, which is well outside the C language.

Being able to do something like an #include, but with a blob of binary data, would be helpful for initializing big arrays. Current practice is to have build scripts convert binary files to C, to have the linker do it, and to rely on assemblers with the capability. None of that is nice to use.

So that we don't have to invoke m4 or do nasty things with recursive macros, the preprocessor could support loops.

There are a few gcc extensions that make macros far more reasonable, including statement expressions and typeof. Add those.

Re:Effective C: An Introduction to Professional C Programming by rseacord on Thursday April 02, 2020 @12:34PM (#22760791)
So there are many ideas here. I commented separately that I would be happy to help members of the community develop quality proposals and champion these to the committee. You can look here http://www.open-std.org/jtc1/sc22/wg14/www/wg14_document_log... to see what proposals normally look like. You would have to develop your suggestions further before they would have a reasonable chance of being adopted.
Re:Effective C: An Introduction to Professional C Programming by Koshkin on Sunday March 29, 2020 @11:59AM (#22719991)
"Not to be rude to Ford but what makes Ford the best manufacturer of trucks?"
Re:Effective C: An Introduction to Professional C Programming by grayed-down on Sunday March 29, 2020 @02:42PM (#22721415)
So it's hard to say that Ford is the best company to make trucks. A slightly lower bar might be, is Ford the best company that has actually made a truck?
Re:Effective C: An Introduction to Professional C Programming by zerr on Sunday March 29, 2020 @12:56PM (#22720505)
That's more than a monthly salary in many places.
Re:Effective C: An Introduction to Professional C Programming by beezle on Sunday March 29, 2020 @09:44AM (#22718948)
I have a 295 page book in production. The print cost for paper bound is $5.46 for case laminate $10.02. Contrary to what you may think, print costs are not going to limit $0. Quite the other way, they have risen over the past seven years from $4.72 and $9.82 (roughly inflation for the paper bound).
Re:Effective C: An Introduction to Professional C Programming by kevin_thibedeau on Sunday March 29, 2020 @12:24PM (#22720224)
2x in seven years is not inflation.

This is what has annoyed me about pulp paperback fiction. They skyrocketed from $5 to $15 in 15 years. Then you can buy the eBook for $12 and feel like you're getting a "deal" on a product with near zero production costs.

Re:Effective C: An Introduction to Professional C Programming by ponow on Sunday March 29, 2020 @07:49AM (#22718212)
It's as fair that you can refuse to pay $60 as it is for the author to ask for it. It strikes me that most people who would pay $30 would also be willing pay $60 in this instance, as it's not as if many new C books are coming out nowadays. So I'm guessing that the author will do better at $60. Medieval notions of profit and the physical costs are mostly irrelevant, but the effort and expertise of the author are not.
Re:Effective C: An Introduction to Professional C Programming by tzjmetron on Sunday March 29, 2020 @08:13AM (#22718328)
It's not about the absolute cost. $60 in a developing country is a substantial sum of money.
Re:Effective C: An Introduction to Professional C Programming by jfkebwjsbx on Sunday March 29, 2020 @10:23AM (#22719198)
So? Should we price everything according to developing countries? Then only those living there could produce things.
Re:Effective C: An Introduction to Professional C Programming by bla3 on Sunday March 29, 2020 @09:23AM (#22718782)
In case you're interested in the book but can't afford it: it's off 30% until Apr 1 with THANKU30, see their main page.
Re:Effective C: An Introduction to Professional C Programming by billpollock on Sunday March 29, 2020 @11:14AM (#22719647)
When you buy print books from us you get the DRM-free ebooks too.

Amazon may ultimately discount this from the list price as they usually do but they are currently deprioritizing books due to the pandemic.

Re:Effective C: An Introduction to Professional C Programming by paedubucher on Sunday March 29, 2020 @08:28AM (#22718428)
Maybe the others here in the forum can tell me, why I should risk buying the pre-order (30% off), when I have no chance of reading a sample chapter yet. (I'm actually thinking of doing this, because I'm looking for a good second book on C after having worked through K&R before.)

When I see that Brian W. Kernighan releases a book, it's an instant buy for me.

Re:Effective C: An Introduction to Professional C Programming by throwaway17_17 on Sunday March 29, 2020 @10:46AM (#22719412)
It is a risk to by the preorder sight unseen. If you are not familiar with author and his style you could end up feeling like you wasted that money.

So until a preview chapter or similar is available I’ll through this link to Modern C, 2nd Ed by Gustedt. It has been well received and I thought Jens writing style was solid.

I don’t know if it is the perfect second book to read on C, but it seems well paced and things are well explained.

https://modernc.gforge.inria.fr/

Re:Effective C: An Introduction to Professional C Programming by rcseacord on Sunday March 29, 2020 @11:17AM (#22719670)
I'm checking with No Starch if we have plans to release a sample chapter of this book. There is a list of previous articles I've written including sample chapters from my previous books on Secure Codign in C and C++ and the CERT C Coding Standard here https://www.informit.com/authors/bio/3312572e-d904-45d5-afcd...

Here is a newer article on Uninitialized Reads published by ACM https://queue.acm.org/detail.cfm?id=3041020

Jens and I are both on the C Standards committee. I would definitely say that our books serve different markets.

Re:Effective C: An Introduction to Professional C Programming by throwaway17_17 on Sunday March 29, 2020 @11:27AM (#22719747)
I have your book on Secure Coding and I have the latest version of Jens’ book as well. I like both your style and his, in terms of writing style and presentation.

If you think there is going to be a large difference in applicability and focus when comparing your ‘Effect C’ and Jens’ ‘Modern C’ I am kind of excited, not just to get your book, but also that even though some people would like to see C be relegated to the trash bin there is still some life left in a language I enjoy using.

Re:Effective C: An Introduction to Professional C Programming by paedubucher on Sunday March 29, 2020 @09:14AM (#22718716)
Nah, fuqit, I'll just buy it ;-)

NoStarch never let me down so far, and paying USD 60 (or 40, or whatever) is such a marginal difference for a book you're going to spends dozens of hours on.

Re:Effective C: An Introduction to Professional C Programming by clarry on Sunday March 29, 2020 @09:45AM (#22718958)
> for a book you're going to spends dozens of hours on.

Is that a feature? I'm constantly frustrated by books that use many words to say little. Wasting hours on such books tends to be negative value, and I shouldn't buy them even for two cents..

Re:Effective C: An Introduction to Professional C Programming by rcseacord on Sunday March 29, 2020 @11:32AM (#22719796)
This book has a very concise writing style. I really wanted to keep it small enough to carry on an airplane (when we are allowed to fly again). I'm really proud of the final product and very happy with the editing staff at No Starch who helped me produce a very polished product.
Re:Effective C: An Introduction to Professional C Programming by paedubucher on Sunday March 29, 2020 @12:31PM (#22720275)
Thanks for the insight! I really appreciate when the authors interact with the community.

Many books nowadays, also from NoStarch, are released as early access books. Your book does not run under the early access program, or at least not yet.

Is this a decision made by you as an author? Or is the kind of book not really suited for early access? I could imagine that introductory books work well as early access books; readers could work through the first couple of chapters, while later chapters are still being written or refined.

Just curious...

Re:Effective C: An Introduction to Professional C Programming by billpollock on Sunday March 29, 2020 @01:29PM (#22720775)
We're getting caught up on our Early Access titles. Our staff is very particular about what they release and they don't like to put chapters in until they feel like they're really final. Given the current world situation I'm making sure that we relax that policy a bit and you'll see more books moving into Early Access in the next 2 or 3 weeks. Just a little hectic around my company at the moment.
Re:Effective C: An Introduction to Professional C Programming by paedubucher on Sunday March 29, 2020 @02:07PM (#22721135)
My intention was really not putting pressure on the publisher as a buyer of this book. I rather wonder why certain books have an early access option and others don't.

I probably won't be able to read it before July, anyway, because I have to finish my bachelor's degree first. But I think it's not a bad time for a financial contribution to my favorite tech book publisher, so I already bought the book "blindly".

Re:Effective C: An Introduction to Professional C Programming by rcseacord on Sunday March 29, 2020 @12:53PM (#22720474)
No, I usually defer decisions concerning the marketing and availability of the book to the publisher. I try to stick to the areas where I'm actually a knowledgeable expert.
Re:Effective C: An Introduction to Professional C Programming by paedubucher on Sunday March 29, 2020 @11:25AM (#22719736)
Working through a technical book of any substance, as opposed to just reading or skimming it, will take dozens of hours, no matter how terse or verbose the style is.

The book is supposed to be around 270 pages, so verbosity probably won't be an issue.

I am right now working through "Python Crash Course" as an intermediate Python programmer. I very quickly read through chapters 1-8 so far and did all the exercises (rather simple ones), just to make sure that I'm not missing out anything on the basics. In the last couple of chapters, I actually picked up two or three pieces of knowledge I wasn't aware of. I spent around five to ten hours on this so far. This approach sounds terribly inefficient.

However, working through a beginner's book as an intermediate Python programmer, and only getting half a dozen of really new information out of it, gives me the confidence I need at this stage. So I don't consider it as a waste, but rather as an exercise in patience and repetition.

Why am I telling you all this? Because I think people overrate the monetary costs of books.

Re:Effective C: An Introduction to Professional C Programming by clarry on Sunday March 29, 2020 @11:52AM (#22719936)
I kind of agree with your point, with the caveat that I just don't want to spend much money if I'm not getting much out of it. I'd happily buy a book for 200 eur if I knew it's going to be worth my time. In the recent years, I've mostly regretted the time I spent on books. Life is short, free time is scarce, and there are so many other things I could be doing.

In this case, I'm definitely curious about the book and would like to skim through it just to satisfy that curiosity, but I have my doubts as to whether I'll get much out of it (I've been writing C for 15 years and I do it professionally). Maybe there are gems of wisdom (or things I've overlooked) in it that would make it worthwhile, but it's possible I'd just regret the time and money spent :-(

Re:Effective C: An Introduction to Professional C Programming by dvfjsdhgfv on Sunday March 29, 2020 @10:54AM (#22719474)
This is an interesting issue. I remember when I started studying discrete math, I actually bought two books. One was by Ross, and it's the one I prefer, but at places it was a bit terse. So when I had trouble understanding something right away, I looked at the same subject in Susanna Epp's book and usually I could find a relevant explanation or example straight away, but in the long term I couldn't stand this verbose style. (By the way, both books cost $80, but you can buy used copies at 1/10.)
Re:Effective C: An Introduction to Professional C Programming by catilac on Sunday March 29, 2020 @09:57AM (#22719023)
I have the same frustration, though in this case I think given the author's expertise I imagine all the words actually contain much wisdom. Hopefully!
Re:Effective C: An Introduction to Professional C Programming by wmwragg on Sunday March 29, 2020 @09:20AM (#22718755)
I've recommended this on here before, but I’ve found "Understanding and Using C Pointers" by Richard Reese, a really wonderful modern book on C.
Re:Effective C: An Introduction to Professional C Programming by cjg_ on Sunday March 29, 2020 @08:18AM (#22718352)
Get the ebook for $47 with a ebook 30% discount on their site? $33.
Re:Effective C: An Introduction to Professional C Programming by billpollock on Sunday March 29, 2020 @12:22PM (#22720204)
Use the coupon code PREORDER (posted on the book's page) and you get the print book + all DRM-free ebooks for US $42 (plus shipping costs)
Re:Effective C: An Introduction to Professional C Programming by matvore on Sunday March 29, 2020 @11:41AM (#22719858)
Is it possible you don't need the book as much as the book's target audience, and that's why it seems overpriced?
Re:Effective C: An Introduction to Professional C Programming by agumonkey on Sunday March 29, 2020 @08:41AM (#22718507)
author had a few other books on secure programming

maybe older books are cheaper

Re:Effective C: An Introduction to Professional C Programming by readme on Sunday March 29, 2020 @12:17PM (#22720160)
I agree, that book can be replaced by reading the classic K&R2 and reading the C standard, you can get your tips/tricks by reading stack overflow posts, and man pages for your API reference.

It's a luxury item. For comparison K&R2 sells for $51.99 new on amazon.

I think a fair price would be $49.99.