From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f180.google.com (mail-ig0-f180.google.com [209.85.213.180]) by dpdk.org (Postfix) with ESMTP id 9370F29CF for ; Wed, 9 Mar 2016 19:53:17 +0100 (CET) Received: by mail-ig0-f180.google.com with SMTP id av4so23629770igc.1 for ; Wed, 09 Mar 2016 10:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=GA1R7zg2bD8juP8Q5YuUc9/m+vFHPJVMs27RLnPSm5I=; b=swP0PA01wj0aenwvPJtoyiOI6Zmb/Z17lSrlwf05/OAOFyN12sxluEuHfNPVkVaW0u GbYDYfGo48LM/j0ifZarKPQXaL8TneBZK/ZRzYfehS2+dLEITnHQhtzmgFa2IeaaCKRz oEZ6Qj44UmJM0HJhfDsPIrUNIBk0voCKeD6i5YsCf/MplR+/wSAU0iEmI4kDJu8D4qSw qQf/xjGdC/l0+aXRSBPwffwqp9bhCCdVmg5qVU23LuTHvvFWWtYd64BD4XKusSRTMeY2 Kk5zmICAN5uq7Sr1x9rEyiuQhM72CdhFO0KrDNC4GSgLuPq8gw0jOtLmZ6s0XP5L/KVe 1nlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=GA1R7zg2bD8juP8Q5YuUc9/m+vFHPJVMs27RLnPSm5I=; b=N1P9HOU3IEwhzJvkpTVWBE7ypeTdcIgDaerSsN0lRAUFUbhUZNBRudDgJciqh1LaVH FmoJl/hsxoJ77hyJUqth2YFVRPCuLZUvOZht3MfCmXxQTBLX2b25BdR1RsFGUCaY+6Jd KZk5ShKFqb1YxRKz9XbF6pFof2OC7TLb85Tr2F9kir5mb1DJQuGOI505hqmn5kIScjNm H2GqeHY3NfqVRbWys1BSnJXwiywM+pbDv5k6OW9PpYnYDuyNlRyq+R0c9PX+AmdLI/iF Bg/2Oqmk+znON3NyfVs3nEsamL4/xiUPwO5T8cGac8ECh/ieAUAD6UZzCgzOsPerZpOI PYSw== X-Gm-Message-State: AD7BkJLMRmN2l/9FWEfXoKXkhP6XtRItxLU2xsp2d7UkKyPORYeWAoe57578LDFdo8F5jvYFXFya/Pvns0UVNQ== MIME-Version: 1.0 X-Received: by 10.50.131.233 with SMTP id op9mr27443619igb.0.1457549597156; Wed, 09 Mar 2016 10:53:17 -0800 (PST) Received: by 10.64.118.226 with HTTP; Wed, 9 Mar 2016 10:53:17 -0800 (PST) In-Reply-To: <1457540381-20274-11-git-send-email-olivier.matz@6wind.com> References: <1457540381-20274-1-git-send-email-olivier.matz@6wind.com> <1457540381-20274-11-git-send-email-olivier.matz@6wind.com> Date: Wed, 9 Mar 2016 10:53:17 -0800 Message-ID: From: Stephen Hemminger To: Olivier Matz Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [RFC 10/35] eal: introduce RTE_DECONST macro X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Mar 2016 18:53:17 -0000 Can't we just write correct code rather than trying to trick the compiler. On Wed, Mar 9, 2016 at 8:19 AM, Olivier Matz wrote: > This macro removes the const attribute of a variable. It must be used > with care in specific situations. It's better to use this macro instead > of a manual cast, as it explicitly shows the intention of the developer. > > This macro is used in the next commit of the series. > > Signed-off-by: Olivier Matz > --- > lib/librte_eal/common/include/rte_common.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/lib/librte_eal/common/include/rte_common.h > b/lib/librte_eal/common/include/rte_common.h > index 332f2a4..dc0fc83 100644 > --- a/lib/librte_eal/common/include/rte_common.h > +++ b/lib/librte_eal/common/include/rte_common.h > @@ -285,6 +285,15 @@ rte_align64pow2(uint64_t v) > > /*********** Other general functions / macros ********/ > > +/** > + * Remove the const attribute of a variable > + * > + * This must be used with care in specific situations. It's better to > + * use this macro instead of a manual cast, as it explicitly shows the > + * intention of the developer. > + */ > +#define RTE_DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) > + > #ifdef __SSE2__ > #include > /** > -- > 2.1.4 > >