LWN.net Logo

What Every C Programmer Should Know About Undefined Behavior #3/3

What Every C Programmer Should Know About Undefined Behavior #3/3

Posted May 24, 2011 17:23 UTC (Tue) by cmccabe (guest, #60281)
In reply to: What Every C Programmer Should Know About Undefined Behavior #3/3 by neilbrown
Parent article: What Every C Programmer Should Know About Undefined Behavior #3/3

It would be interesting if C++ had a "use strict" mode similar to Perl. Something that would try to eliminate the worst abuses. The problem is that there really is a lot less consensus on what "the worst abuses" are than in Perl. I have my own list, but I'm sure that posting it here would generate a flamewar (and probably lead to me educating a lot of people about obscure C++ trivia).

I know that you realize this (and clearly all the kernel developers do too), but a lot of developers don't realize that you can use C exactly like a "simpler C++." Instead of classes, you have functions which all take a pointer to a struct. Instead of private methods, you have functions which are static to a file. Instead of virtual functions, you have tables of function pointers.

I would also encourage anyone who is tired of C++ to check out Google Go. At least give it a try.


(Log in to post comments)

What Every C Programmer Should Know About Undefined Behavior #3/3

Posted Jun 5, 2011 11:07 UTC (Sun) by JanC_ (guest, #34940) [Link]

I'm sure somebody can write a 2400 page book to define a safe subset of C++ ;-)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds