Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #71369 > unrolled thread

C++ variable names

Started byT <T@invalid.invalid>
First post2020-01-15 18:31 -0800
Last post2020-01-16 13:58 -0800
Articles 3 on this page of 63 — 18 participants

Back to article view | Back to comp.lang.c++


Contents

  C++ variable names T <T@invalid.invalid> - 2020-01-15 18:31 -0800
    Re: C++ variable names Daniel <danielaparker@gmail.com> - 2020-01-15 18:42 -0800
      Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 18:46 -0800
        Re: C++ variable names Daniel <danielaparker@gmail.com> - 2020-01-15 21:30 -0800
          Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 21:52 -0800
        Re: C++ variable names Louis Krupp <lkrupp@nospam.pssw.com.invalid> - 2020-01-15 23:44 -0700
          Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 22:59 -0800
            Re: C++ variable names Bo Persson <bo@bo-persson.se> - 2020-01-16 08:44 +0100
              Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 23:48 -0800
              Re: C++ variable names David Brown <david.brown@hesbynett.no> - 2020-01-16 10:08 +0100
            Re: C++ variable names Louis Krupp <lkrupp@nospam.pssw.com.invalid> - 2020-01-16 00:43 -0700
              Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 23:51 -0800
                Re: C++ variable names Louis Krupp <lkrupp@nospam.pssw.com.invalid> - 2020-01-16 01:39 -0700
                  Re: C++ variable names T <T@invalid.invalid> - 2020-01-16 14:01 -0800
      Re: C++ variable names Lynn McGuire <lynnmcguire5@gmail.com> - 2020-01-16 15:48 -0600
        Re: C++ variable names Öö Tiib <ootiib@hot.ee> - 2020-01-16 14:11 -0800
          Re: C++ variable names Lynn McGuire <lynnmcguire5@gmail.com> - 2020-01-17 18:52 -0600
          Re: C++ variable names Manfred <noname@add.invalid> - 2020-01-18 16:22 +0100
            Re: C++ variable names Öö Tiib <ootiib@hot.ee> - 2020-01-18 10:41 -0800
            Re: C++ variable names Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-01-21 05:31 -0800
        Re: C++ variable names David Brown <david.brown@hesbynett.no> - 2020-01-16 23:32 +0100
        Re: C++ variable names legalize+jeeves@mail.xmission.com (Richard) - 2020-01-19 19:13 +0000
    Re: C++ variable names red floyd <no.spam@its.invalid> - 2020-01-15 18:45 -0800
      Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 18:47 -0800
      Re: C++ variable names Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-01-15 21:51 -0800
        Re: C++ variable names red floyd <no.spam@its.invalid> - 2020-01-15 22:44 -0800
          Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 23:00 -0800
    Re: C++ variable names "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-15 19:40 -0800
      Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 19:58 -0800
        Re: C++ variable names "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-15 20:12 -0800
      Re: C++ variable names James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-15 23:18 -0500
        Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 20:20 -0800
          Re: C++ variable names James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-16 12:06 -0800
            Re: C++ variable names T <T@invalid.invalid> - 2020-01-16 14:02 -0800
        Re: C++ variable names "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-15 20:31 -0800
          Re: C++ variable names David Brown <david.brown@hesbynett.no> - 2020-01-16 11:09 +0100
    Re: C++ variable names Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-01-16 03:52 +0000
      Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 19:59 -0800
        Re: C++ variable names Bo Persson <bo@bo-persson.se> - 2020-01-16 06:33 +0100
          Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 21:53 -0800
    Re: C++ variable names Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-16 06:18 +0100
      Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 21:54 -0800
        Re: C++ variable names Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-16 06:59 +0100
          Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 22:31 -0800
            Re: C++ variable names Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-01-16 00:15 -0800
            Re: C++ variable names Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-16 11:25 +0100
              Re: C++ variable names Mister2U@honorific.org - 2020-01-16 11:47 +0000
                Re: C++ variable names Bonita Montero <Bonita.Montero@gmail.com> - 2020-01-16 13:31 +0100
                  Re: C++ variable names "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-16 15:51 -0800
                    Re: C++ variable names "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-16 15:51 -0800
                    Re: C++ variable names Manfred <invalid@add.invalid> - 2020-01-17 01:31 +0100
    Re: C++ variable names Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-01-15 21:48 -0800
      Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 21:55 -0800
        Re: C++ variable names Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-01-16 00:01 -0800
      Re: C++ variable names "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-15 22:28 -0800
        Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 22:31 -0800
    Re: C++ variable names "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-15 23:16 -0800
      Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 23:26 -0800
        Re: C++ variable names "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2020-01-15 23:34 -0800
          Re: C++ variable names T <T@invalid.invalid> - 2020-01-15 23:53 -0800
            Re: C++ variable names Louis Krupp <lkrupp@nospam.pssw.com.invalid> - 2020-01-16 03:04 -0700
    C++ variable names James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-16 11:51 -0800
      Re: C++ variable names T <T@invalid.invalid> - 2020-01-16 13:58 -0800

Page 4 of 4 — ← Prev page 1 2 3 [4]


#71413

FromLouis Krupp <lkrupp@nospam.pssw.com.invalid>
Date2020-01-16 03:04 -0700
Message-ID<r0d02fdg0l0qs0pgn490828ggekrduqgvl@4ax.com>
In reply to#71407
On Wed, 15 Jan 2020 23:53:26 -0800, T <T@invalid.invalid> wrote:

>On 2020-01-15 23:34, Chris M. Thomasson wrote:
>> On 1/15/2020 11:26 PM, T wrote:
>>> On 2020-01-15 23:16, Chris M. Thomasson wrote:
>>>> On 1/15/2020 6:31 PM, T wrote:
>>>>> 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
>>>>
>>>>
>>>> When creating a new type at this early stage is your learning 
>>>> process, use hyper-verbose names for things to get a feel. Try to 
>>>> name your types something nice and descriptive:
>>>>
>>>> No struct rs, or struct r. Something more on par with:
>>>>
>>>> struct room_settings
>>>> {
>>>>     int some_setting_ambient_light_0;
>>>>     int some_setting_1;
>>>> };
>>>>
>>>> struct room
>>>> {
>>>>      struct room_settings settings;
>>>> };
>>>>
>>>> Actually, think of programming a little text adventure game. Its 
>>>> great fun! Try to beat Beyond Zork... ;^)
>>>>
>>>> Create a 5 room puzzle, with encounters, and all sorts of fun stuff.
>>>
>>> Huh?  I just want the equivalent C++ name of some
>>> C names for a paper I am writing for Raku's NativeCall
>> 
>> Oh shi%. Nevermind. For some reason, I thought you were learning C.
>> 
>
>Only as much as I need to run NativeCall.
>
>C is for folks way smarter than me.  I don't
>know how your guys do it without going insane.
>My hat is off to you guys.

Don't sell yourself short. You can do this. Besides, what have you got
against going insane?

I think you'll find learning C a whole lot easier than doing whatever
it is you're trying to do *without* knowing anything substantial about
C.

Louis

[toc] | [prev] | [next] | [standalone]


#71422

FromJames Kuyper <jameskuyper@alumni.caltech.edu>
Date2020-01-16 11:51 -0800
Message-ID<8c2a1bbe-89ae-4594-bd1c-8599bb6e6d98@googlegroups.com>
In reply to#71369
T wrote:

> 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

Those are not variable names. Those are typedef names declared in <stdint.h>. A typedef name is an alias for some other type.
If you put the preprocessing directive

#include <stdint.h>

in a C++ program, those exact same typedef names will be introduced into the global namespace. Most C code that uses those names will need little or no modification to have the exact behavior in C++. And if modification is needed, it won't involve changing those names.

If you use <cstdint> rather than <stdint.h> in C++ code, those typedefs will be declared in the std:: namespace, which is somewhat safer, but the cost of that increased safety is that you will sometimes have to write std::int8_t rather than plain int8_t. The necessity of doing so is precisely what makes it safer.

> float in C

That, on the other hand, is a C keyword that is also a C++ keyword, with precisely the same meaning in both languages. 

> Do I just drop the "_t"?

No.

[toc] | [prev] | [next] | [standalone]


#71427

FromT <T@invalid.invalid>
Date2020-01-16 13:58 -0800
Message-ID<qvqma0$u96$1@dont-email.me>
In reply to#71422
On 2020-01-16 11:51, James Kuyper wrote:
> T wrote:
> 
>> 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
> 
> Those are not variable names. Those are typedef names declared in <stdint.h>. A typedef name is an alias for some other type.

My bad

> If you put the preprocessing directive
> 
> #include <stdint.h>
> 
> in a C++ program, those exact same typedef names will be introduced into the global namespace. Most C code that uses those names will need little or no modification to have the exact behavior in C++. And if modification is needed, it won't involve changing those names.
> 
> If you use <cstdint> rather than <stdint.h> in C++ code, those typedefs will be declared in the std:: namespace, which is somewhat safer, but the cost of that increased safety is that you will sometimes have to write std::int8_t rather than plain int8_t. The necessity of doing so is precisely what makes it safer.
> 
>> float in C
> 
> That, on the other hand, is a C keyword that is also a C++ keyword, with precisely the same meaning in both languages.
> 
>> Do I just drop the "_t"?
> 
> No.
> 

Thank you!

[toc] | [prev] | [standalone]


Page 4 of 4 — ← Prev page 1 2 3 [4]

Back to top | Article view | comp.lang.c++


csiph-web