- C++ variable names - 23 Updates
- Cloud cuckoo land? - 2 Updates
T <T@invalid.invalid>: Jan 15 06:31PM -0800 Hi All, 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"? Many thanks, -T |
Daniel <danielaparker@gmail.com>: Jan 15 06:42PM -0800 On Wednesday, January 15, 2020 at 9:32:02 PM UTC-5, T wrote: > the C++ variables names that go with these > C variable names? > int8_t in C ... > Do I just drop the "_t"? In general it's considered to be bad practice to adorn a variable name with type information. Daniel |
red floyd <no.spam@its.invalid>: Jan 15 06:45PM -0800 On 1/15/20 6:31 PM, T wrote: > Hi All, > Sorry for the homework assignment. > <redacted> Please see FAQ 5.2. Do your own homework. |
T <T@invalid.invalid>: Jan 15 06:46PM -0800 On 2020-01-15 18:42, Daniel wrote: > In general it's considered to be bad practice to adorn a variable name > with type information. > Daniel I am getting this list from: https://docs.raku.org/language/nativetypes#Types_with_native_representation_and_size What do you recommend (I clearly have no idea what I am doing)? |
T <T@invalid.invalid>: Jan 15 06:47PM -0800 On 2020-01-15 18:45, red floyd wrote: >> Sorry for the homework assignment. >> <redacted> > Please see FAQ 5.2. Do your own homework. I have no idea where to find FAQ 5.2. I am completely at your mercy here. Do you have a link for me? |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Jan 15 07:40PM -0800 On 1/15/2020 6:31 PM, T wrote: > uint64_t in C > float in C > Do I just drop the "_t"? Fwiw, *_t postfix conflicts with POSIX namespace. |
Ben Bacarisse <ben.usenet@bsb.me.uk>: Jan 16 03:52AM > uint64_t in C > float in C > Do I just drop the "_t"? They have the same names in C++. Depending on what header file you include to get them, they may be in the std:: namespace, but the name itself is the same. -- Ben. |
T <T@invalid.invalid>: Jan 15 07:58PM -0800 On 2020-01-15 19:40, Chris M. Thomasson wrote: >> float in C >> Do I just drop the "_t"? > Fwiw, *_t postfix conflicts with POSIX namespace. Can I just drop them then? And can you give me a reference to the POSIX namespace? The folks I am dealing with won't take my word for it. Are the names the same in C++ if I drop the _t? |
T <T@invalid.invalid>: Jan 15 07:59PM -0800 On 2020-01-15 19:52, Ben Bacarisse wrote: > They have the same names in C++. Depending on what header file you > include to get them, they may be in the std:: namespace, but the name > itself is the sam Thank you! Also, what is the _t and can I drop it? |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Jan 15 08:12PM -0800 On 1/15/2020 7:58 PM, T wrote: >>> Do I just drop the "_t"? >> Fwiw, *_t postfix conflicts with POSIX namespace. > Can I just drop them then? Take a deep look at: http://www.cplusplus.com/reference/cstdint When dealing with POSIX, the *_t can be an interesting thing indeed. You need to use the correct type name to use any type. > And can you give me a reference to the POSIX namespace? Take ptread_mutex_t: https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_lock.html Well, the damn *_t is in the POSIX namespace. However, if not using POSIX, then this is mute. |
James Kuyper <jameskuyper@alumni.caltech.edu>: Jan 15 11:18PM -0500 On 1/15/20 10:40 PM, Chris M. Thomasson wrote: >> float in C >> Do I just drop the "_t"? > Fwiw, *_t postfix conflicts with POSIX namespace. POSIX reserves such postfixes for the purpose of identifying types. These are types. POSIX mandates support for a compiler that conforms to the C standard, so there is no such conflict. |
T <T@invalid.invalid>: Jan 15 08:20PM -0800 On 2020-01-15 20:18, James Kuyper wrote: > POSIX reserves such postfixes for the purpose of identifying types. > These are types. POSIX mandates support for a compiler that conforms to > the C standard, so there is no such conflict. Any problem dropping the _t then? |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Jan 15 08:31PM -0800 On 1/15/2020 8:18 PM, James Kuyper wrote: >>> Do I just drop the "_t"? >> Fwiw, *_t postfix conflicts with POSIX namespace. > POSIX reserves such postfixes for the purpose of identifying types. I was advised a long time ago to drop any *_t wrt keeping Kosher within the POSIX namespace. |
Bonita Montero <Bonita.Montero@gmail.com>: Jan 16 06:18AM +0100 > uint32_t in C > uint64_t in C > float in C That are all no variable-names but type-names ! Hrhr. ;-) |
Daniel <danielaparker@gmail.com>: Jan 15 09:30PM -0800 On Wednesday, January 15, 2020 at 9:46:21 PM UTC-5, T wrote: > What do you recommend (I clearly have no idea what I am doing)? What do you need to do? In the expression int8_t x; int8_t is the name of a type (an 8-bit integer value), x is the name of a variable of type int8_t. Are you looking for a naming convention for variables? Something else? Daniel |
Bo Persson <bo@bo-persson.se>: Jan 16 06:33AM +0100 On 2020-01-16 at 04:59, T wrote: >> itself is the sam > Thank you! > Also, what is the _t and can I drop it? There is no magic here. An identifier can contain a-z, A-Z, 0-9, and underscores. A name like int64_t contains a combination of lowercase letters, digits, and underscore. Nothing special about that. The _t is just a convention that (generally) indicates that the identifier is a typedef in the C library, like typedef short int16_t; typedef unsigned int uint32_t; Variable names are also identifiers and have the same format as type names. You can just choose whatever name you want, like int32_t x; or some better name than x, that tells us what the variable is supposed to be used for. As the _t is used in some typedef-names, it is generally a good idea not to use it in other names. Bo Persson |
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Jan 15 09:48PM -0800 > 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 <stdint.h>, imported into C++ as <cstdint>. 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 */ |
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Jan 15 09:51PM -0800 >> Sorry for the homework assignment. >> <redacted> > Please see FAQ 5.2. Do your own homework. I also don't know what you mean by "FAQ 5.2". Question 5.2 in the comp.lang.c FAQ <http://www.c-faq.com> is about null pointers and is not relevant here. The most current C++ FAQ <https://isocpp.org/faq> doesn't number its questions. -- 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 */ |
T <T@invalid.invalid>: Jan 15 09:52PM -0800 On 2020-01-15 21:30, Daniel wrote: > variable of type int8_t. Are you looking for a naming convention for > variables? Something else? > Daniel The names are the same in C and C++. I would like now to know if I should include the _t in either or both? |
T <T@invalid.invalid>: Jan 15 09:53PM -0800 On 2020-01-15 21:33, Bo Persson wrote: > As the _t is used in some typedef-names, it is generally a good idea not > to use it in other names. > Bo Persson Hi Bo, Thank you. I will include the _t! -T |
T <T@invalid.invalid>: Jan 15 09:54PM -0800 On 2020-01-15 21:18, Bonita Montero wrote: >> uint64_t in C >> float in C > That are all no variable-names but type-names ! Hrhr. ;-) oops. I meant type names. :'( |
T <T@invalid.invalid>: Jan 15 09:55PM -0800 On 2020-01-15 21:48, Keith Thompson wrote: > 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. You hit it perfectly. Thank you! |
Bonita Montero <Bonita.Montero@gmail.com>: Jan 16 06:59AM +0100 >>> float in C >> That are all no variable-names but type-names ! Hrhr. ;-) > oops. I meant type names. Ok, except float all types are preceded with "std::" in C++. float has the same typename. |
woodbrian77@gmail.com: Jan 15 04:24PM -0800 On Wednesday, January 15, 2020 at 4:09:59 PM UTC-6, Daniel wrote: > > my on-line code generator: > > https://github.com/Ebenezer-group/onwards > Is anyone using this? Nobody is raising issues. I'm looking for some external users. I'm willing to help someone on their project if we use my software as part of the project. More info here: http://webEbenezer.net/about.html Brian |
woodbrian77@gmail.com: Jan 15 05:38PM -0800 On Wednesday, January 15, 2020 at 5:21:26 PM UTC-6, Öö Tiib wrote: > > Is anyone using this? Nobody is raising issues. > His serialization format is not even documented. Plus he wants to > keep something of it The serialization format isn't proprietary. What's private/ proprietary is the program that generates the code. I have a library and 3 programs that use the library. The library and two of the programs are in the repository. The third program, though is closed source. And I encourage other developers to not neglect developing some closed source. > proprietary and closed source and so there > likely will never be actual users. Unlike a lot of services out there, it's free. Once we get past the whiners, the sky is the limit. > formats or for any of serialization libraries that use those formats. > Online or offline does not matter. Anyone can put offline tool out > as online service as idle time hobby within weeks. It's 2020 and C++ compilers are not written as services. Have compiler vendors lost track of what they should be doing in part due to an avalanche of features added to the language? Brian Ebenezer Enterprises - Enjoying programming again. http://webEbenezer.net |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment