🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4711

Re: Code short circuit

#4711
From: Bruce Salzman
Date: Wed, 07 Dec 2005 14:25
43 lines
2336 bytes
"Thomas Maeder [TeamB]" <maeder@glue.ch> wrote in message 
news:m28xuxuxcx.fsf@glue.ch...

> What does "optimized away" mean?
>
> Please post a complete, but minimal (<50 lines) program that
> demonstrates what you are doing, along with a description of how you
> expect the program to behave and how it effectively does.

Optimized away was perhaps a bad choice of words. In fact, I have 
optimization turned off. It seems that the compiler just decides that 
the switch variable can never equal the cases.

I don't think I can extract a <50 line program, but this is the 
procedure in question. There are no globals that would affect this 
routine.

BTW, I tried Paolo's suggestion and added a global variable, and that 
fixed the problem!

void TMyMDIFrame::EvSysCommand(uint cmdtype, TPoint& p)
{
      // "Eat" these system commands to disable maximizing,
     // minimizing, and sizing functionality.
        uint cmd = cmdtype & 0xFFF0;
        switch (cmd)
        {
            case SC_MAXIMIZE:
            case SC_RESTORE:
            case SC_MINIMIZE:
            case SC_MOVE:
            case SC_SIZE:
                 return;
            default:
                 break;
        }
    }
    TDecoratedMDIFrame::EvSysCommand(cmdtype, p);
}

-- 
Bruce 
Technical Details
Message-ID: <4396f0a8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43961a6f@newsgroups.borland.com> <m28xuxuxcx.fsf@glue.ch>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c4f5899a764a1e0
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: " Bruce Salzman" <bruce@nospam.org>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43961a6f@newsgroups.borland.com> <m28xuxuxcx.fsf@glue.ch>
Subject: Re: Code short circuit
Date: Wed, 7 Dec 2005 08:25:38 -0600
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 24.94.228.231
Message-ID: <4396f0a8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1133965480 24.94.228.231 (7 Dec 2005 06:24:40 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail