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

Home » Imported messages » comp.lang.php » terminate a PHP script
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: terminate a PHP script [message #172642 is a reply to message #172625] Wed, 23 February 2011 08:18 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
sheldonlg wrote:
> On 2/21/2011 10:55 PM, The Natural Philosopher wrote:
>> sheldonlg wrote:
>>> On 2/21/2011 8:46 PM, The Natural Philosopher wrote:
>>>> sheldonlg wrote:
>>>> > On 2/21/2011 7:28 PM, The Natural Philosopher wrote:
>>>> >> sheldonlg wrote:
>>>> >>> On 2/21/2011 12:06 PM, Denis McMahon wrote:
>>>> >>>> On 21/02/11 16:51, n00m wrote:
>>>> >>>>>> No, you should not use goto! It causes more problems than it
>>>> >>>>>> solves.
>>>> >>>>>
>>>> >>>>> Why on the earth???
>>>> >>>>> "goto" can produce 10000 empty lines in no time. Like this:
>>>> >>>>
>>>> >>>> Because there is no structure to a program that uses goto. When it
>>>> >>>> fails
>>>> >>>> to work properly (and it will) it can become impossible to see
>>>> >>>> how it
>>>> >>>> arrived at the point that it fails at.
>>>> >>>>
>>>> >>>>> $cnt = 0;
>>>> >>>>>
>>>> >>>>> mm:
>>>> >>>>> ++$cnt;
>>>> >>>>> echo '<BR>';
>>>> >>>>> if ($cnt< 10000) goto mm;
>>>> >>>>
>>>> >>>> Your goto method uses 5 lines. A while loop uses 2:
>>>> >>>>
>>>> >>>> $i = 10000;
>>>> >>>> while ($i--) echo "<br>\n";
>>>> >>>>
>>>> >>>> and a for loop only 1:
>>>> >>>>
>>>> >>>> for ($cnt = 10000; $cnt--;) echo "<br>\n";
>>>> >>>>
>>>> >>>> or:
>>>> >>>>
>>>> >>>> for ($cnt = 0; $cnt< 10000; $cnt++) echo "<br>\n";
>>>> >>>>
>>>> >>>> Rgds
>>>> >>>>
>>>> >>>> Denis McMahon
>>>> >>>
>>>> >>> I fully agree about gotos. There is NO need for them. What is wrong
>>>> >>> with this pseudocode?
>>>> >>>
>>>> >>> ===========
>>>> >>> if (passes test for failure condition) {
>>>> >>> ... all the rest of the code for success that is already there
>>>> >>> --- except the footer
>>>> >>> }
>>>> >>>
>>>> >>> footer stuff.
>>>> >>> ==========
>>>> >>>
>>>> >>> All it does is add two lines (the if test and a closing brace) and
>>>> >>> one
>>>> >>> level of indentation, and it does what the OP wants.
>>>> >>>
>>>> >>> Since seeing the if-then-else first appear in Fortran circa 1980, I
>>>> >>> have never used a single goto in any language in which I have coded.
>>>> >>>
>>>> >> Well that's cos you never wrote Assembler :-)
>>>> >>
>>>> >
>>>> > Correct! That was before even my time. :-) By the time I got into it
>>>> > with Fortran IV, the compiled code looked an awful lot like Assembly
>>>> > code. Machines should be labor saving devices. That was what the
>>>> > compiler was for. Besides, it is much easier to debug and maintain a
>>>> > language that is readable, and not like spaghetti code (gotos and
>>>> > jumps).
>>>> >
>>>> The art of writing assembler, is to MAKE it readable DESPITE the
>>>> language.
>>>>
>>>> And, if you wanted to write hardware code in the 80's for them new
>>>> fangled Micro Processors, that mate, was all there was!
>>>
>>> I understand that. I also understand that this is three decades later.
>>> Do you still wear leisure suits
>>
>> I never did.
>>
>> and sport an Afro
>>
>> Mm. almost
>>
>> or go to discos?
>>
>> I never did that either beyond as brief foray into running, then
>> building them, in the 60. and 70's..
>>
>> BUT I can assure you assembler is alive and well, and still used where
>> the high level languages don't cut the mustard.
>>
>> As I said, here we talk noddy scripts in PHP, but that's not always what
>> all of us have done. Or still do.
>>
>> I have a project on the back burner which if I ever resurrect it, will
>> have to be done in PIC or ATMEL assembler, because nothing else will get
>> the speed at the price..
>>
>> I'll probably do a lot in C as well, the scheduler and main task will be
>> assembler, because I have to squeeze every clock cycle out of it.
>>
>>
>> I'll bet your video card is not programmed in Pascal or PHP either :-)
>>
>>
>> And the core of whatever OS you use. Its easier to write a pre-emptive
>> scheduler in assembler than even in C, though I *think* its possible
>> given that the compiler can handle interrupt service routines.
>>
>> I do know last time I did that, it got too hard, and i coded the core in
>> Assembler, and having done that, a lot more than I strictly needed to,
>> simply because it was easier to keep all that low level stuff in one set
>> of files.
>>
>>
>> Its a mistake to consider that the code one writes, is of the same ilk
>> as the code others write. Most of my programming has been at very low
>> level, hardware, OS, drivers, Bioses, comms code, a bi of commercial
>> applications, and database, but not that much till I came thisaway and
>> stared writing simple stuff for web sites. I mean really people make a
>> huge fuss over PHP, but its diddly squat compared to writing rom based
>> assembler to bootstrap a motherboard from cold. Its interpreted, so no
>> compile test debug cycles. Its block structured, so you don't have to
>> worry about trampling in the wrong bit of RAM, its not time critical bar
>> a few odd cases...basically you guys are just bored because you don't
>> have to work hard enough, so you spend your time arguing the niceties of
>> style ;-)
>
> The point I, and others, are making is that we are talking about coding
> where a high level language is appropriate. We are not talking about
> the cases you mention above. I would not even attempt some of those
> things because I never learned assembler and that arena did not interest
> me. Not all programming is for everyone. Does an artist have to worry
> about the manufacturing process of the brushes he uses? All he needs is
> to know that he has a good brush to do his job. All we need to know is
> that we have a good, structured, high level language to do the job we
> need to do. We do not have to separate all the bristles in the brush
> and then use them one at a time.
>
> Do you own a car? If you do, then then next time you get into it to go
> somewhere why don't you ask yourself "Why am I doing this? I guess it
> is because I don't have to work hard enough to walk there. So, I ride
> and am bored so I turn on the radio and scan through the stations."
>
> High level languages are labor saving devices, both in the creation AND
> the maintenance of code. That is why they were created!
>
> It ain't just niceties!
>
>

You miss my point.

Which was that coding is simply not challenging enough for you so you
have time to talk about niceties. :-)

That doesn't mean I advocate writing in assembler to make the job harder.

Merely that sadly for many people coding is simply the tedious and dull
job of turning specifications into 'bits in silicon' that will do a job.

Of which sometimes the only pleasure is imagining how it might be done
slightly differently.









>
[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
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: Extralight browser-webserver communication via cookies (+)
Next Topic: Storing multiple character set types (or a representation of em) in a table column
Goto Forum:
  

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

Current Time: Fri Jul 05 19:10:11 GMT 2024

Total time taken to generate the page: 0.04189 seconds