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


Groups > comp.lang.c++ > #71385

Re: C++ variable names

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c++
Subject Re: C++ variable names
Date 2020-01-15 21:48 -0800
Organization None to speak of
Message-ID <8736cghry7.fsf@nosuchdomain.example.com> (permalink)
References <qvohup$gar$1@dont-email.me>

Show all headers | View raw


T <T@invalid.invalid> 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 <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 */

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web