Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: C++ variable names Date: Wed, 15 Jan 2020 21:48:48 -0800 Organization: None to speak of Lines: 50 Message-ID: <8736cghry7.fsf@nosuchdomain.example.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="71ac4e0bc340f3cd3245a2ba0fe88e42"; logging-data="7670"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fz2eD/b0gB/IEwar7rWEa" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cancel-Lock: sha1:MvvK3MDhtVe9ViHZbwtSnWR3+7I= sha1:vMyFfz8OtlWlS3LzO7yTh13ZQyg= Xref: csiph.com comp.lang.c++:71385 T writes: > Sorry for the homework assignment. > > Would some kind individual please fill in > the C++ variables names that go with these > C variable names? > > int8_t in C > int16_t in C > int32_t in C > int64_t in C > uint8_t in C > uint16_t in C > uint32_t in C > uint64_t in C > float in C > > Do I just drop the "_t"? Those are type names. not variable names. The [u]int*_t names are defined in the C standard header , imported into C++ as . float is a reserved word and the name of a floating-point type. They're all exactly the same in C and in C++ (except that the *_t type names might be in the std:: namespace in C++). The "_t" suffix is simply part of the name. I don't know why you'd want to drop it. (It's a convention indicating that it's a type name, but it's not a convention that's universally followed.) As mentioned later in the thread, POSIX reserves _t suffixes for some purposes, but since POSIX is based on C and all these identifiers are defined by the C standard, there is no conflict. For example, dropping the "_t" from int8_t would give you int8, which is not defined anywhere in C or C++. You can certainly define something called "int8" if you like, just as you can define something called "foo42" if you like. Since you mentioned "variables", it's possible that you're asking for good names for variables of these types. If so, each variable should have a name that reflects the meaning of that variable. It's possible that I've misunderstood what you're asking. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com [Note updated email address] Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */