From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <5cf02fd3b416bf1db1b7c58217511630@yyc.orthanc.ca> To: 9fans@9fans.net From: "Lyndon Nerenberg (VE6BBM/VE7TFX)" Date: Mon, 8 Feb 2010 09:39:39 -0700 In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] NaN, +Inf, and -Inf, constants? Topicbox-Message-UUID: d05dfee0-ead5-11e9-9d60-3106f5b1d025 > why does being able to switch on any enum trump > the ability to define constants without #define? Because enum's legacy is that of a 'first class' int-like object, which can be subject to the usual set of int-like operations. switch() is one of those. #define isn't. > if you try, sizeof(foo)==4, but you'll need to remove > 'd' since you can't have a string. you can't switch on > a vlong or float. would be nice, though. Why not a string? If you can extend an enum to include floats, why not an integer representation of a pointer? And yes, I also think switching on vlongs would be useful. > the plan 9 style is never to typedef or name enums. It may not be the style for the Labs, but that's not the case for everyone. The compile time type checking named enums provide isn't something I'd want to lose. > if it were an error to name or typedef an enum > containing non-int members, there would be no > problem. This could work. But I have to agree with Bakul: 'static const' is a much better fit for the language. --lyndon