[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] register keyword?

From: Kurt Schwehr
Subject: Re: [gpsd-dev] register keyword?
Date: Mon, 22 Jan 2018 16:59:51 -0800


I was in C mode the whole time and if you add the pragma for optimization, you will find the results of with and without register are the same.

Don't be fooled by the //

On Mon, Jan 22, 2018 at 3:25 PM, Gary E. Miller <address@hidden> wrote:
Yo Kurt!

On Mon, 22 Jan 2018 15:04:13 -0800
Kurt Schwehr <address@hidden> wrote:

> The general compiler folks consensus is that the optimizers generally
> just ignore register and it's being removed from C++17.  Linking
> against C++17 code is my main reason for this.

Uh, this is C code, not C++ code.  What are you linking it to?

> But that's why we have to easily try it out.

Well, that is fun.  It also shows the register keyword really helps.  Ar
least when I select a C compiler.

> Looking at gcc x86-64 7.2, the assembly without register is shorter.

I see your point in C++ mode, but not in C mode.  In C mode the
register keyword is a real win.

>    #pragma GCC optimize("O3")
> The assembly with and without registers is exactly the same.

Except gpsd does not use -O3.  I see similar on -o2, which gpsd does
use, except that optimization will not work for a linked in function.

Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin


Attachment: Screen Shot 2018-01-22 at 4.58.42 PM.png
Description: PNG image

reply via email to

[Prev in Thread] Current Thread [Next in Thread]