From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: insert-header-preprocessor-definition Date: Mon, 16 Apr 2018 12:35:36 +0700 Message-ID: References: <86fu429udy.fsf@zoho.com> <87lgdt21a4.fsf@bsb.me.uk> <86zi29earx.fsf@zoho.com> <87y3htzclf.fsf@bsb.me.uk> <86po317392.fsf@zoho.com> <871sfhp9hb.fsf@bsb.me.uk> <86604s9rrj.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1523856861 13893 195.159.176.226 (16 Apr 2018 05:34:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 16 Apr 2018 05:34:21 +0000 (UTC) Cc: help-gnu-emacs To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 16 07:34:17 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f7wmO-0003W0-Ek for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Apr 2018 07:34:16 +0200 Original-Received: from localhost ([::1]:45556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f7woV-0002vR-4V for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Apr 2018 01:36:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f7wo2-0002uk-Ps for help-gnu-emacs@gnu.org; Mon, 16 Apr 2018 01:35:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f7wo1-0006Gx-Oz for help-gnu-emacs@gnu.org; Mon, 16 Apr 2018 01:35:58 -0400 Original-Received: from mail-ot0-x22b.google.com ([2607:f8b0:4003:c0f::22b]:37677) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f7wo1-0006Gp-IM for help-gnu-emacs@gnu.org; Mon, 16 Apr 2018 01:35:57 -0400 Original-Received: by mail-ot0-x22b.google.com with SMTP id y46-v6so16064809otd.4 for ; Sun, 15 Apr 2018 22:35:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=7o9oeqn6szLajNwU9uzT3RZsp+oqVt4H400JXkSLyv0=; b=ZdTD4GiygW7M1F8Ad1Xtu1zH/eMjWMNz4DHtXXE8JUXHFOoxgJluvFQS32mZjnkvmH 8OBEKg6ck0iEuoYWmI579lBoXDEeClZ3GJQUTtcEmXGB71IjQCbuhBCeJwiKA6qbagXp dqzGo/3W9Mg28L/fuwA2B3kOJh6PDIQTS6LT/zGvYuNRcJq1Kr/AiKeJdjqJrj+YVJ6b F06dfid25yCgTUXWCPisTjBS0fp20RB4lrtiEZ2So4a4CLMyD17huzxdlwKXuO7q7ERs 3OpmOkShTo5YptoKM72ePs+M7DgdhgTrRBMsH09+mDxgyLMCEMbUhrjLmbOQS6b2hx1+ x+Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=7o9oeqn6szLajNwU9uzT3RZsp+oqVt4H400JXkSLyv0=; b=fONBEd8wfn4kOwtTGqc+jaUN0I8GmjTiosUqVl7QufPN2ykvpxSWu4GbHSR+66/eVA jMP5uInM7oTOVsRpOx2YZ0+u43pmctaEsjxigR6NxAH4++nbfW3vypbNqcc6YUNvBBz5 Pz3VkZFTbY53h5pt2SqS5iot1++JK9LOaoyy4SZuog7wk9u6yxgKrKGhK2WS7JPqCLrj ZGyLyXrcBNihN9ZmJRyXLEq5f1UX6vjyTOrviV6dD2aGjvWdL483b0aQD0hwiZ7utadt lqhuE89MY2LXxcipDo68doHZ5eSq+1C3Bp3BF58djiS5Q78DQc6i8uoAjpJb47GIphxd mGqw== X-Gm-Message-State: ALQs6tBttjAqwpAImR4PPWrLaI6Nqeo+NTZTUlNPuKtFiC6qPoXKVTId Q98hU3McTma/+AknRx1DvB1Tw5/80RFpOmouJKo= X-Google-Smtp-Source: AIpwx49DzVYPP8IhhcfHqjCCMFnty3mNi0yczRYpWvMGNbe1tNZtHRNObykaQ4e54uor021HF3j3ThDh0fa/cqy795c= X-Received: by 2002:a9d:2328:: with SMTP id j37-v6mr10031168otb.355.1523856956678; Sun, 15 Apr 2018 22:35:56 -0700 (PDT) Original-Received: by 10.74.186.8 with HTTP; Sun, 15 Apr 2018 22:35:36 -0700 (PDT) In-Reply-To: <86604s9rrj.fsf@zoho.com> X-Google-Sender-Auth: NRM14Zfkv2zXfuQu9K75HI6kto4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::22b X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116542 Archived-At: On Mon, Apr 16, 2018 at 2:46 AM, Emanuel Berg wrote: >> The practical solution is, of course, the >> same as with all name conflict issues: >> Namespacing. That is, in your project, you >> start all preprocessor defines with the name >> of your project. > > Woah, is *that* what people mean with > "namespacing"? I thought that was something > more advanced! Well, yes, I define namespacing as the means to subdivide a _space_ of _names_ into subspaces so that names from different subspaces are guaranteed to not clash. Each such subspace is a _namespace_. Many languages and environments have first-class support for namespaces. For example, in the UNIX file system, a directory is a namespace. In C++, a fully qualified name starts with ::, followed by namespace names separated by ::, followed by an identifier. > I remember people using it in C++ and I removed > it telling everyone it was a bad idea and > instead one should use the whole path to > identify things. Some languages let programmers access all names in a namespace as if they were local. In C++, =E2=80=9Cusing namespace foo;=E2=80=9D; in Python,= =E2=80=9Cfrom foo import *=E2=80=9D; etc. By many coding standards and conventions, these are discouraged, because they make it harder to reason about the complete set of names accessible at a point, and where each name comes from. In small scopes, wholesale importing a namespace is okay, and sometimes even necessary. >> On the other hand, the two or three compilers >> out there that are most likely to be used to >> compile your project already support >> #pragma once. > > I'm on gcc 4.9. Should I get away with the > guards and use '#pragma once' instead? https://en.wikipedia.org/wiki/Pragma_once#Portability says GCC has supported #pragma once since 3.4. Of course, when you work in a team, such decisions are best taken collectiv= ely.