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

Home » Imported messages » comp.lang.php » Operator precedence
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Operator precedence [message #185075 is a reply to message #185067] Tue, 25 February 2014 21:01 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 2/25/2014 2:19 PM, Christoph Michael Becker wrote:
> Jerry Stuckle wrote:
>
>> On 2/25/2014 11:56 AM, Ben Bacarisse wrote:
>>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
>>>
>>>> On 2/24/2014 11:32 PM, Ben Bacarisse wrote:
>>>> > Jerry Stuckle <jstucklex(at)attglobal(dot)net> writes:
>>>> >
>>>> >> For instance a 32 bit C compiler will have different results than a 64
>>>> >> bit C compiler, even if both are run on a 64 bit machine. And even
>>>> >> different 32 bit C compilers can have different output. For instance,
>>>> >> in a 32 bit C compiler, an int can be 8, 16, or 32 bits long - all
>>>> >> within the specs
>>>> >
>>>> > No, C does no permit int to be less that 16 bits wide -- 8 is not
>>>> > allowed.
>>>>
>>>> Actually, the ANSI C spec DOES allow it. The spec sets no hard
>>>> minimum or maximum for the size of any of the numeric values. C can
>>>> still run on 8 bit processors, also (as in imbedded systems).
>>>
>>> It seems odd to be disagreeing about easily verifiable facts. ANSI C is
>>> often used to refer to the first C standard (1989), in which case look
>>> at section 2.2.4.2 "Numerical limits". If you mean the current ANSI
>>> standard, that's ISO/IEC 9899:2011 and the section you need is
>>> "5.2.4.2.1 Sizes of integer types <limits.h>". (You also need the
>>> section from each that states that the constraints imposed by limits.h
>>> apply to both hosted and free-standing implementations.)
>>>
>>
>> As I said before - I wore my ANSI C standard out and tossed it quite a
>> while back. But even then it did not specify a minimum of 16 bits for
>> an integer. There are still 8 bit processors and compilers out there.
>>
>>>> >> (which only states the length of an int is >= the
>>>> >> length of a short, and <= the length of a long). So it is entirely
>>>> >> possible one C compiler will have a 16 bit int, while another has a 32
>>>> >> bit int. And both are within the C spec.
>>>> >
>>>> > Yes, but the language gives minimum guarantees which can be used to
>>>> > permit code to be ported. It also (often) explicitly says where there
>>>> > is no guarantee. For example, shifting right by the width of the type
>>>> > being shifted is explicitly "undefined". It's useful to know that,
>>>> > because you can simply avoid the situation in the first place. That's
>>>> > simpler that testing it, seeing that it does what you expect, and then
>>>> > finding that it fails on some other hardware.
>>>>
>>>> The only minimum is that an int must not be smaller than a short.
>>>
>>> No, there are others -- in particular, a minimum range of representable
>>> values for each of the standard integer types. For int it is from
>>> -32767 to +32767.
>>>
>>
>> Then please tell me how an 8 bit compiler can be ANSI Standard? There
>> are some out there. It's been a while since I did any work on one, but
>> I know of several embedded systems which are still in use (and being
>> updated).
>
> It's not necessarily impossible to implement 16bit operations on an 8bit
> machine. I did this long ago on a 6510, and actually it was rather simple.
>
>> I have my own problems with PHP - for instance, it is entirely possible
>> to create an object without calling a constructor - a violation of OO
>> principles. But I work around it.
>
> How is it possible to create an object without its constructor (if
> defined) being called?
>

Load the object from the $_SESSION. The constructor will not be called.

However, the constructor is called when the original object was created,
and the destructor called when the original object goes out of scope.
The destructor is also called when the object loaded from the $_SESSION
goes out of scope.

The result is one constructor call and two destructor calls. A
violation of OO principles.


--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
[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
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: Correlating curl resources to some other object.
Next Topic: Experienced Web designer required
Goto Forum:
  

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

Current Time: Fri May 10 10:38:48 GMT 2024

Total time taken to generate the page: 0.03373 seconds