FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » switch with case 0
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: switch with case 0 [message #182607 is a reply to message #182599] Sat, 17 August 2013 17:58 Go to previous messageGo to previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma:
Senior Member
In article <kuo9bl$4h9$1(at)news(dot)albasani(dot)net>,
The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:

> On 17/08/13 16:56, Peter H. Coffin wrote:
>> Strong-typing introduces its own complications: Are we going to cast
>> implicitly between numeric types?
>
> No.
>> it makes me 100% behind "We're a loosely-typed language and it works
>> how it works. If you want to know HOW it's going to work in a
>> particular case, don't guess, test or look at the source. Which we
>> make available."
> That is the problem in a nutshell. With a strongly typed language I
> don't HAVE to look at the source code. Ther are no implicit rules.There
> are only explicit rules and if I say:
>
> float c;
>
> I don't mean char c, char * c; cha** c, char c[]. int c, double c or int
> *float(c) ; or anything else.
> and I HOPE the compiler will tell me I am being sloppy when I return a
> zero from a function that should return a pointer.
>
> and furthermore if I say case 0: , it doesn't mean case '0' or case "0"
> or case 0.0 but it can surely mean (because its defined that way) case
> FALSE, and may mean case NULL. but with a few errors thrown up abut
> implicit casts.

I'd rather not have to bother. And I like to be able to do:


$num = (some calculation here);

if ($num==0) $num = "no";

echo "There were " . $num . " widgets\n";


for example.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: AND and OR
Next Topic: Compiling PHP 5.x on Cygwin
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 16:38:37 GMT 2024

Total time taken to generate the page: 0.04489 seconds