1. Computers
  2. Display Drivers
  3. Graphics Cards
  4. Memory
  5. Motherboards
  6. Processors
  7. Software
  8. Storage
  9. Operating Systems


Facebook RSS Twitter Twitter Google Plus


Phoronix Test Suite

OpenBenchmarking.org

John Carmack's Comments On C/C++

Gaming

Published on 14 January 2013 02:44 PM EST
Written by Michael Larabel in Gaming
66 Comments

John Carmack, the veteran game programmer that co-founded id Software and was the lead developer on the id Tech engine and their most popular game titles, has shared some new opinions on C/C++ programming as it pertains to the id Tech game engine.

As a comment to an article about The exceptional beauty of Doom 3's source-code, Carmack responded himself with some additional food for thought about C++ and C.
In some ways, I still think the Quake 3 code is cleaner, as a final evolution of my C style, rather than the first iteration of my C++ style, but it may be more of a factor of the smaller total line count, or the fact that I haven’t really looked at it in a decade. I do think "good C++" is better than "good C" from a readability standpoint, all other things being equal.

I sort of meandered into C++ with Doom 3 – I was an experienced C programmer with OOP background from NeXT’s Objective-C, so I just started writing C++ without any proper study of usage and idiom. In retrospect, I very much wish I had read Effective C++ and some other material. A couple of the other programmers had prior C++ experience, but they mostly followed the stylistic choices I set.

I mistrusted templates for many years, and still use them with restraint, but I eventually decided I liked strong typing more than I disliked weird code in headers. The debate on STL is still ongoing here at Id, and gets a little spirited. Back when Doom 3 was started, using STL was almost certainly not a good call, but reasonable arguments can be made for it today, even in games.

I am a full const nazi nowadays, and I chide any programmer that doesn’t const every variable and parameter that can be.

The major evolution that is still going on for me is towards a more functional programming style, which involves unlearning a lot of old habits, and backing away from some OOP directions.

About The Author
Michael Larabel is the principal author of Phoronix.com and founded the web-site in 2004 with a focus on enriching the Linux hardware experience and being the largest web-site devoted to Linux hardware reviews, particularly for products relevant to Linux gamers and enthusiasts but also commonly reviewing servers/workstations and embedded Linux devices. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics hardware drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated testing software. He can be followed via and or contacted via .
Latest Linux Hardware Reviews
  1. Intel Pentium G3258 On Linux
  2. SilverStone Precision PS10
  3. ASRock Z97 Extreme6
  4. Nouveau Re-Clocking Is Way Faster, Shows Much Progress For Open-Source NVIDIA
Latest Linux Articles
  1. KVM Benchmarks On Ubuntu 14.10
  2. X.Org Server 1.16 Officially Released With Terrific Features
  3. Ubuntu With Linux 3.16 Smashes OS X 10.9.4 On The MacBook Air
  4. Preview: Benchmarking CentOS 7.0 & Scientific Linux 7.0
Latest Linux News
  1. Intel 3.0 X.Org Driver Still Baking, New Development Release
  2. Eric Anholt Makes Progress With Broadcom VC4 Graphics Driver
  3. Intel Is Getting Very Close To OpenGL 4.0/4.1/4.2 Mesa Support
  4. Valve Is Still Hiring For SteamOS, Linux Work
  5. Users Warned About Possible Regressions With DRI3
  6. GNOME Shell Gets Wayland HiDPI Fonts, Mutter Gets Touch Gestures
  7. BPTC Texture Compression Comes To Nouveau After Intel's Work
  8. Development Continues For Supporting EXT4 On NVDIMMs
  9. Libinput 0.5 Improves Pointer Acceleration, Adds A Configuration API
  10. Linux 3.17 To Fix Up ASPM, Bring Other PCI Changes
Latest Forum Discussions
  1. Next-Gen OpenGL To Be Announced Next Month
  2. Open-Source Radeon Performance Boosted By Linux 3.16
  3. Remote gui not accessible in Phoronix Test Suite 5.2
  4. AMD "Hawaii" Open-Source GPU Acceleration Still Not Working Right
  5. Updated and Optimized Ubuntu Free Graphics Drivers
  6. In Road To Qt, Audacious Switches From GTK3 Back To GTK2
  7. Debian + Steam + r600
  8. Ubuntu With Linux 3.16 Smashes OS X 10.9.4 On The MacBook Air