Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Uncle Steve Newsgroups: comp.lang.c Subject: Re: Types in C Date: Mon, 23 May 2011 21:22:23 -0400 Organization: Friends of the Galactic Collective Lines: 84 Message-ID: <5936f04f8e60065-d6df3@gmail.com> References: <43d4ef5f7d2b0f9-0f635@gmail.com> <9401m9Ft2pU9@mid.individual.net> <50d915539d62563-19304@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="job9yP/rmK/fxQbJrcqEcA"; logging-data="9075"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Evv8oIVnWw4scTBfa4GLN" User-Agent: nn 6.7.3 Content-Length: 3358 Cancel-Lock: sha1:eWKDScRj2NIPFHblYWV2zy4avKA= Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:4643 On Mon, May 23, 2011 at 11:57:10PM +0000, Seebs wrote: > On 2011-05-23, Uncle Steve wrote: > > On Mon, May 23, 2011 at 10:24:31PM +0000, Seebs wrote: > >> On 2011-05-23, Uncle Steve wrote: > >> > There are no "user defined" types in C. > > >> Sure there are! > > > Oh, no there aren't! > > Well, I'll qualify it: > > There are rules in C for defining things which the language calls > "types" and which participate fully in the general C rules about type > aliasing and type safety. > > >> So? Doesn't make them not types. Pointers, arrays, enums, structs, > >> unions... all types. Structs and unions are user-defined. And they are > >> types. This makes them... *drumroll* user-defined types. > > > Not if we make a finer distinction between types. > > That distinction is *within* the category of "types", though. Absolutely correct, but I think it may be an error to use the word "type" to mean several different things: 'basic' types, aggregates of basic types, enumerated types, unions, structures, and function definitions. All these things have wildly different semantics and varying syntax. They aren't all interchangable, and therefore are differing entities. We say 'type', but the definition changes depending on what we are discussing. > > char, int, long, float, void *, etc. are /basic types/ fundamental to > > the implementation of the C language (and arithmetic operations). > > Compound types are aggregates of these basic types as well as compound > > types. There's a fundamental difference you are ignoring given a > > sufficient vague definition of 'type'. > > No, I'm not ignoring that difference. I'm stating that it is a difference > between some types and other types; between basic types and derived types, > say. Or basic types and aggregate types. > > But aggregate types are still types! I have no real argument there except to say that an aggregate type is not the same thing as a basic type, even if the way they are used in a program can be similar. For instance, everyone knows that the address of an integer, float, structure, or function can be taken. Yet, I cannot perform addition on functions. They are different things. > > A real user-defined type would be something new like the complex > > numbers extension in gcc. > > No, that would be a new user-defined *basic* type. The word "type" has > a very rigorous meaning in C, and aggregate types are types, and user-defined > types exist. That only some kinds of types can be user-defined doesn't > change that. Again, there is a huge qualitative difference between defining a new integer type and a structure type. > >> I would guess that one of the times to use macros is "when you have to > >> be portable to compilers that don't have inline functions". That's > >> definitely a key application. > > > gmp is well into version 4; I doubt it would compile where there is no > > support for inline functions, but I have not verified this. > > As pointed out: gmp is part of the bootstrap process for gcc. It compiles > on pretty old stuff, by necessity. Which version of gmp does gcc use these days to support those old platforms? Regards, Uncle Steve -- Should a professional politician be charged with molestation if he kisses babies while attending political rallies?