From: Joseph M. Newcomer on 16 Jun 2010 20:55 Thanks. I thought that had been delayed to the C 0x spec. Since we don't have C99 compilers from Microsoft, I never noticed. joe On Wed, 16 Jun 2010 18:01:29 -0300, Cholo Lennon <chololennon(a)hotmail.com> wrote: >On 16/06/2010 13:17, Joseph M. Newcomer wrote: >> See below... >> On Wed, 16 Jun 2010 10:36:08 -0500, Stephen Myers >> <""StephenMyers\"@discussions(a)microsoft.com"> wrote: >> >>> >>> JCO wrote: >>>> int x = sizeof(true); >>>> int y = sizeof(TRUE); >>>> >>>> x is 1 >>>> y is 4 >>>> Okay so the size if different? >>>> I always attempt to use lowercase when possible. >>>> >>>> "r norman"<r_s_norman(a)comcast.net> wrote in message >>>> news:haoh16pjir0uk12jdjdrdih03gi4g0kfgp(a)4ax.com... >>>>> On Wed, 16 Jun 2010 09:23:44 -0500, "JCO"<someone(a)somewhere.com> >>>>> wrote: >>>>> >>>>>> What exactly is the difference. This has always bothered me that >>>>>> this is >>>>>> the case. I've noticed that you cannot substitute one for the >>>>>> other. I'm >>>>>> guessing TRUE was the original way of doing things before "true" came >>>>>> along? >>>>>> The same case can be made with FALSE vs false. >>>>>> >>>>> >>>>> Compare sizeof(TRUE) with sizeof(true). >>>>> >>>>> I believe TRUE/FALSE were introduced before true/false became standard >>>>> in C (and then C++). Once they were well entrenched in the Windows >>>>> libraries it would have broken too much old code to change everything >>>>> to be consistent. >>>> >>> >>> TRUE and FALSE are the original C way of doing things. >> **** >> No. This has nothing to do with the C language and everything to do with the Windows >> header files. >> **** >>> >>> Windows defines a BOOL data type which is a 32 integer. This >>> corresponds to TRUE and FALSE. >> **** >> No, a data type cannot correspond to a value. The *type* is 32-bit integer. There are >> two defined literal values, TRUE (1) and FALSE(0). >> **** >>> >>> You should be able to find #define typedef or enum definitions for BOOL, >>> TRUE and FALSE. >> **** >> windef.h >> **** >>> >>> The bool data type is a relatively recent addition and is supported >>> internally by the compiler. It's size is normally a byte. >> **** >> It exists only in the C++ language at the moment. It is scheduled to exist in the next C >> standard, if that comes out in this century. The joke is that it used to be called the "C >> 0x" standard because it was going to be released sometime before 2010. Now it is known as >> the "C xx" standard, the "C 2x0x" standard, and the "C 2xxx" standard, since there seems >> to be little hope of any agreement about its release date. I heard one wag refer to it as >> the "C Fry" standard, since it may not come out until Philip J. Fry is defrosted. >> joe >> **** > >C99 already has a boolean type: _Bool (see C99 specification 6.25, >6.3.1.2, 6.4.1 and 6.7.2) >It also has a group of macros to manage the bool behavior (bool, false >and true, see stdbool.h header, C99 specification 7.16) > >Regards Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Stuart Redmann on 17 Jun 2010 02:33 On 16 Jun., Joseph M. Newcomer wrote: > Any good programmer could be successfully accused of having obsessive-compulsive disorder > (OCD). A friend of mine, one of the very best programmers I know, related once that he > was taking medication to help his OCD, and I pointed out that was what made him one of the > best of the best. He said "Yes, but it was spilling into everyday life". Like you, I am > not overly compulsive in most other areas of my life; I don't wash my hands 100 times a > day, or sort my sock drawer by spectral color, or things like that; my office is a total > shambles. But I really do apply tidiness guidelines to my code. And in that, I am > definitely obsessive. Except when it comes to top-posting ;-) (sorry, could not resist) Thanks for putting a name to something that I always felt, but could never express in words. I guess this OCD streak may be the reason why I studied computer science instead of physics (I mean how should one get things done when your material sometimes behaves like a wave and sometimes like a particle?) Computer science offers fewer surprises than physics (with regard to new phenomenons) but in return you'll certainly get the feeling that everything is neat and proper (which is what people suffering from OCD probably need). Regards, Stuart
From: Joseph M. Newcomer on 17 Jun 2010 09:40 The arguments about top-posting vs. bottom-posting vs. anything else are all silly. My reply appears where my reply appears. I refuse to deal with profound silliness. I only obsess over technical issues that *matter*. One variant of OCD is characterized by meticulous attention to detail. There is a silly psychological test that tries to tell you about your personality type. It contains silly questions like "Do you care about the big picture or little details?" and of course the answer is "yes". In fact, I was halfway through it when I started laughing. EVERY either-or question was answerable by "yes". As a programmer, I *have* to care about the little details. But as a software architect and designer, I *have* to care about the "big picture". Every question I'd hit had that property. It was clear that the questions had never been designed with a programmer in mind... joe On Wed, 16 Jun 2010 23:33:25 -0700 (PDT), Stuart Redmann <DerTopper(a)web.de> wrote: >On 16 Jun., Joseph M. Newcomer wrote: >> Any good programmer could be successfully accused of having obsessive-compulsive disorder >> (OCD). �A friend of mine, one of the very best programmers I know, related once that he >> was taking medication to help his OCD, and I pointed out that was what made him one of the >> best of the best. �He said "Yes, but it was spilling into everyday life". �Like you, I am >> not overly compulsive in most other areas of my life; I don't wash my hands 100 times a >> day, or sort my sock drawer by spectral color, or things like that; my office is a total >> shambles. �But I really do apply tidiness guidelines to my code. �And in that, I am >> definitely obsessive. > >Except when it comes to top-posting ;-) (sorry, could not resist) > >Thanks for putting a name to something that I always felt, but could >never express in words. I guess this OCD streak may be the reason why >I studied computer science instead of physics (I mean how should one >get things done when your material sometimes behaves like a wave and >sometimes like a particle?) Computer science offers fewer surprises >than physics (with regard to new phenomenons) but in return you'll >certainly get the feeling that everything is neat and proper (which is >what people suffering from OCD probably need). > >Regards, >Stuart Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: David Webber on 17 Jun 2010 10:22 "Stuart Redmann" <DerTopper(a)web.de> wrote in message news:82b0294d-3ff3-4b5d-9f9e-629a6bdaffe7(a)a30g2000yqn.googlegroups.com... > On 16 Jun., Joseph M. Newcomer wrote: > ... I guess this OCD streak may be the reason why > I studied computer science instead of physics (I mean how should one > get things done when your material sometimes behaves like a wave and > sometimes like a particle?) Being precise and tidy is a good route to understanding how things work in physics as well as programming. Wave/particle duality is a case in point. Precisely speaking: the probability amplitude for finding a particle at a given point is a function characterised as a wave. Nothing inconsistent about that. The less precise version: "It's a wave AND a particle" is just untidy and being untidy leads to a lack of understanding, but may be good for making the uninitiated go "wow!". Pedantry (if not OCD) helps in physics too, though it may not impress television audiences. Dave Sometime elementary particle theorist.
From: Giovanni Dicanio on 17 Jun 2010 10:35
On 17/06/2010 16:22, David Webber wrote: > Wave/particle duality is a case in point. Precisely speaking: the > probability amplitude for finding a particle at a given point is a > function characterised as a wave. > Dave > Sometime elementary particle theorist. Cool! That is "rocket science"! (Computer Science is easier :) Giovanni |