logo       

Re: Phalanx: What if full coverage isn't possible?: msg#00071

Subject: Re: Phalanx: What if full coverage isn't possible?
>> I just ran into a similar "problem" in POE::Driver::SysRW.  For
>> portability I have a couple lines similar to
>>
>>     $! = 0 if $! == EAGAIN or $! == EWOULDBLOCK;
>>
>> EAGAIN and EWOULDBLOCK are identical on most systems.  In fact, one is
>> usually defined in terms of the other.  They differ on a few platforms,
>> however, and it's important to check both.
> 
> Redefine EAGAIN and EWOULDBLOCK (they're just perl constants), and rerun
> that code, after setting $!.  (Your code probably isn't written so that
> is in one callable place, but it could be.)
> 
> This is probably a good example of where it's too silly to force it to
> test all the possibilities, but it is possible.

I don't think it's silly at all - if "it's important to check both" then you
would want to have tests that cover situations which can occur on platforms
other than your own, otherwise you can't really be sure that you have
provided the logic you seek.

as you mention, local-style redefinition is just the solution for code like
this - I, for one, always get confused about operator precidence in cases
just slightly more complex than the one above, and prefer to use tests (and
parens :) to make sure I got it right.

--Geoff



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe