background preloader

Google C++ Style Guide

Google C++ Style Guide
Definition: Streams are a replacement for printf() and scanf(). Pros: With streams, you do not need to know the type of the object you are printing. You do not have problems with format strings not matching the argument list. (Though with gcc, you do not have that problem with printf either.) Cons: Streams make it difficult to do functionality like pread(). Decision: Do not use streams, except where required by a logging interface. There are various pros and cons to using streams, but in this case, as in many other cases, consistency trumps the debate. Extended Discussion There has been debate on this issue, so this explains the reasoning in greater depth. Proponents of streams have argued that streams are the obvious choice of the two, but the issue is not actually so clear. cout << this; // Prints the address cout << *this; // Prints the contents The compiler does not generate an error because << has been overloaded. And so on and so forth for any issue you might bring up.

C++ Language Tutorial This website uses cookies. By continuing, you give permission to deploy cookies, as detailed in our privacy policy. ok Search: Not logged in C++ Language These tutorials explain the C++ language from its basics up to the newest features introduced by C++11. Introduction Compilers Basics of C++ Program structure Compound data types Classes Other language features C++ Standard Library Input/Output with files Tutorials C++ LanguageAscii CodesBoolean OperationsNumerical Bases C++ Language Introduction:CompilersBasics of C++:Program structure:Compound data types:Classes:Other language features:Standard library:Input/output with files Namespace visibility in C# Java has package scoping. It allows an element to be visible only within the same namespace. It's a wonderful thing. Here's how it works in Java: package com.pc-doctor.mynamespace; package class Foo { ... } The class Foo is only visibile within mynamespace. Even though I'm not a Java programmer, this immediately strikes me as extremely useful. There are two reasons to want namespace visibility to be enforced by your compiler: If you can make those classes invisible outside the namespace, it will make life a lot easier for clients of that namespace. The Microsoft Way Microsoft expects you to make the classes internal. However, you have to make a separate assembly for each namespace that you want to do this with. Frankly, that's painful enough that few people do it. The C++ Way C++ also lacks namespace visibility. This is an easy thing to do, but it doesn't do much in C#. The end result is that a lot of detail namespaces will be visible. Even with those problems, it's probably worth doing in C#.

Open Mikros Image Code Style Guidelines for Contributors The rules below are not guidelines or recommendations, but strict rules. Contributions to Android generally will not be accepted if they do not adhere to these rules. Not all existing code follows these rules, but all new code is expected to. Java Language Rules We follow standard Java coding conventions. We add a few rules: Don't Ignore Exceptions Sometimes it is tempting to write code that completely ignores an exception like this: void setServerPort(String value) { try { serverPort = Integer.parseInt(value); } catch (NumberFormatException e) { }} You must never do this. Anytime somebody has an empty catch clause they should have a creepy feeling. Acceptable alternatives (in order of preference) are: Don't Catch Generic Exception Sometimes it is tempting to be lazy when catching exceptions and do something like this: You should not do this. Alternatives to catching generic Exception: Catch each exception separately as separate catch blocks after a single try. Don't Use Finalizers import foo or and

Programming Tutorials: C++ Made Easy and C Made Easy Welcome! If you're new to C++, I recommend you purchase my ebook, Jumping into C++, a complete step-by-step guide for beginners. If you're looking for free tutorials, learn C++ with our C++ tutorial, starting at C++ Made Easy, Lesson 1 (all lessons) If you want to learn C instead, check out our C tutorial C Made Easy, Lesson 1 (all lessons) Want more advanced material on C, C++ graphics, game programming or algorithms? C++ Tutorial, C++ Made Easy: Learning to Program in C++ Learn C++ with this tutorial, designed for beginners and containing lots of examples, tips and simple explanations. C Tutorial - C Made Easy This tutorial is based on the above tutorial, but uses only standard C language features. More Advanced C and C++ Language Feature Tutorials [Top] C++11 - the new C++ standard C++11 is the new C++ standard, and it's chock full of goodness for C++ programmers, old and new. C++ Standard Template Library (STL) tutorials Understanding Floating Point Numbers by Jeff Bezanson By Ben Marchant

Cours de C/C++ - Club des décideurs et professionnels en Informa Ce livre est un cours de programmation en C et C++. Il s'adresse aux personnes qui ont déjà quelques notions de programmation dans un langage quelconque. Les connaissances requises ne sont pas très élevées cependant : il n'est pas nécessaire d'avoir fait de grands programmes pour lire ce document. Il suffit d'avoir vu ce qu'est un programme et compris les grands principes de la programmation. Lire l'article. Article lu 35350 fois. Vous avez aimé ce tutoriel ? inPartager Les sources présentées sur cette page sont libres de droits et vous pouvez les utiliser à votre convenance.

A successful Git branching model » nvie.com Note of reflection (March 5, 2020)This model was conceived in 2010, now more than 10 years ago, and not very long after Git itself came into being. In those 10 years, git-flow (the branching model laid out in this article) has become hugely popular in many a software team to the point where people have started treating it like a standard of sorts — but unfortunately also as a dogma or panacea.During those 10 years, Git itself has taken the world by a storm, and the most popular type of software that is being developed with Git is shifting more towards web apps — at least in my filter bubble. Web apps are typically continuously delivered, not rolled back, and you don't have to support multiple versions of the software running in the wild.This is not the class of software that I had in mind when I wrote the blog post 10 years ago. Why git? For a thorough discussion on the pros and cons of Git compared to centralized source code control systems, see the web. The main branches ¶ develop

Get that job at Google I've been meaning to write up some tips on interviewing at Google for a good long time now. I keep putting it off, though, because it's going to make you mad. Probably. For some statistical definition of "you", it's very likely to upset you. Why? Hey man, I don't know that stuffStevey's talking abooooooutIf my boss thinks it's importantI'm gonna get fiiiiiiiiiiredOooh yeah baaaby baaaay-beeeeee.... I didn't realize this was such a typical reaction back when I first started writing about interviewing, way back at other companies. See, it goes like this: Me: blah blah blah, I like asking question X in interviews, blah blah blah... You: Question X? Me: So in conclusion, blah blah... huh? You: Aaaaaaauuuggh!!! Me: That's it. It doesn't matter what X is, either. But THEN, time passes, and interview candidates come and go, and we always wind up saying: "Gosh, we sure wish that obviously smart person had prepared a little better for his or her interviews. Caveats and Disclaimers Oho! Me: Yes. So!

Introduction to Make Introduction to Make by Jennifer Vesperman 01/31/2002 Make originated as a system for building compiled code. It is now used as a system for making changes across many files and directories. Make is useful for system administrators as well as developers. Running Make Make requires a configuration file. The usual name for this file is Makefile; the capitalization lists the makefile with README and other special files. When run with no arguments, GNU Make looks for the configuration files named GNUmakefile, Makefile, and makefile in the current working directory. The makefile in this example displays make complete and does nothing else. $ls makefile renamed_makefile $make echo make complete make complete $make -f renamed_makefile echo make complete make complete $make -s make complete Simple Makefiles The examples in this article are written for C, and produce the sample target file. Experienced users of Make will see redundant lines in the example makefile. A Make rule is composed of:

Cours de C/C++ Christian Casteyde Copyright © 2003 Christian Casteyde Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". Permission vous est donnée de copier, distribuer et modifier ce document selon les termes de la licence GNU pour les documentations libres, version 1.1 ou toute autre version ultérieure publiée par la Free Software Foundation. Une copie de cette licence est incluse dans l'annexe intitulée "GNU Free Documentation License".

styleguide - Style guides for Google-originated open-source projects vector Vectors are sequence containers representing arrays that can change in size. Just like arrays, vectors use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to its elements, and just as efficiently as in arrays. But unlike arrays, their size can change dynamically, with their storage being handled automatically by the container. Internally, vectors use a dynamically allocated array to store their elements. Instead, vector containers may allocate some extra storage to accommodate for possible growth, and thus the container may have an actual capacity greater than the storage strictly needed to contain its elements (i.e., its size). Therefore, compared to arrays, vectors consume more memory in exchange for the ability to manage storage and grow dynamically in an efficient way.

C++ Reference [C++ Reference] Doxygen Generate documentation from source code Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice flavors), Fortran, VHDL, Tcl, and to some extent D. Doxygen can help you in three ways: It can generate an on-line documentation browser (in HTML) and/or an off-line reference manual (in ) from a set of documented source files. Doxygen is developed under Mac OS X and Linux, but is set-up to be highly portable. Doxygen license Copyright © 1997-2016 by Dimitri van Heesch. Permission to use, copy, modify, and distribute this software and its documentation under the terms of the GNU General Public License is hereby granted. Documents produced by doxygen are derivative works derived from the input used in their production; they are not affected by this license. Sponsored links(not related to doxygen)

Related: