LearnBitcoin

Bitcoin Dev Archive 2011

bitcoin scope issue in main.cpp

5 messages, 23 to 24 Oct 2011. Started by John Smith.

John Smith (3), theymos, Amir Taaki

Permalink Original thread on gnusha.org

John Smith permalink original

FYI It's in a disabled feature (replacement), so I'm not sure how important this is, but it doesn't look good.

---------- Forwarded message ---------- From: Dean Gores <dmgores@gmail•com> Date: Sun, Oct 23, 2011 at 11:15 AM Subject: bitcoin scope issue in main.cpp To: laanwj@gmail•com

You have "i" and "output" declared in the same scope in "main.cpp", AcceptToMemoryPool. Below is the offending code.

           for (int i = 0; i < vin.size(); i++)
           {
               COutPoint outpoint = vin[i].prevout;
               if (!mapNextTx.count(outpoint) ||
mapNextTx[outpoint].ptx != ptxOld)
                   return false;
           }

Cheers, Dean Gores

theymos in reply to John Smith permalink original

It's legal for a scope to define variables with names that conflict with the names of variables in higher-level scopes.

John Smith in reply to theymos permalink original

Yes, I know that. It compiles.

If we pulled all the 'This is legal in C++' tricks in the bitcoin source it would be even less maintainable and readable than now. But whatever...

JS

On Sun, Oct 23, 2011 at 10:51 PM, theymos <theymos@mm•st> wrote:

Quoted text (15 lines)
> It's legal for a scope to define variables with names that conflict with
> the names of variables in higher-level scopes.
>
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
Amir Taaki in reply to John Smith permalink original

Hahaha you mean like unitialised variables, inheriting from containers with non-virtual dtors (CScript) and delicious copy pasta coding (PushMessage, bignum and serialize stuff).

No need to worry about that :)

________________________________ From: John Smith <witchspace81@gmail•com> To: theymos <theymos@mm•st> Cc: bitcoin-development@lists•sourceforge•net Sent: Monday, October 24, 2011 6:02 AM Subject: Re: [Bitcoin-development] Fwd: bitcoin scope issue in main.cpp

Yes, I know that. It compiles.

If we pulled all the 'This is legal in C++' tricks in the bitcoin source it would be even less maintainable and readable than now. But whatever...

JS

On Sun, Oct 23, 2011 at 10:51 PM, theymos <theymos@mm•st> wrote:

It's legal for a scope to define variables with names that conflict with

Quoted text (13 lines)
>the names of variables in higher-level scopes.
>
>------------------------------------------------------------------------------
>The demand for IT networking professionals continues to grow, and the
>demand for specialized networking skills is growing even more rapidly.
>Take a complimentary Learning@Cisco Self-Assessment and learn
>about Cisco certifications, training, and career opportunities.
>http://p.sf.net/sfu/cisco-dev2dev
>_______________________________________________
>Bitcoin-development mailing list
>Bitcoin-development@lists•sourceforge•net
>https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
John Smith in reply to Amir Taaki permalink original

Yes, you're right, there is a lot of code is in the "fun with knives" category.

JS

On Mon, Oct 24, 2011 at 4:31 PM, Amir Taaki <zgenjix@yahoo•com> wrote:

Quoted text (67 lines)
> Hahaha you mean like unitialised variables, inheriting from containers with
> non-virtual dtors (CScript) and delicious copy pasta coding (PushMessage,
> bignum and serialize stuff).
>
> No need to worry about that :)
>
> ------------------------------
> *From:* John Smith <witchspace81@gmail•com>
> *To:* theymos <theymos@mm•st>
> *Cc:* bitcoin-development@lists•sourceforge•net
> *Sent:* Monday, October 24, 2011 6:02 AM
> *Subject:* Re: [Bitcoin-development] Fwd: bitcoin scope issue in main.cpp
>
>
> Yes, I know that. It compiles.
>
> If we pulled all the 'This is legal in C++' tricks in the bitcoin source it
> would be even less maintainable and readable than now. But whatever...
>
> JS
>
> On Sun, Oct 23, 2011 at 10:51 PM, theymos <theymos@mm•st> wrote:
>
> It's legal for a scope to define variables with names that conflict with
> the names of variables in higher-level scopes.
>
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>
>
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>
>
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge•net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
>