unsigned short, short literals

Discussion in 'C Programming' started by Ioannis Vranos, Mar 4, 2008.

  1. AFAIK, there aren't any character designations for short and unsigned
    short literals, like UL/ul are for unsigned long literals, under
    C90/C95, right?
    Ioannis Vranos, Mar 4, 2008
    #1
    1. Advertising

  2. Ioannis Vranos <> wrote:
    > AFAIK, there aren't any character designations for short
    > and unsigned short literals, like UL/ul are for unsigned
    > long literals, under C90/C95, right?


    Right. Since they're subject to integral promotion, there's
    little need. Longs on the other hand do need something.
    Consider 1ul << 17.

    --
    Peter
    Peter Nilsson, Mar 4, 2008
    #2
    1. Advertising

  3. In article <fqkhnt$1uen$>,
    Ioannis Vranos <> wrote:
    >AFAIK, there aren't any character designations for short and unsigned
    >short literals, like UL/ul are for unsigned long literals, under
    >C90/C95, right?


    Correct at least for C89, but C89 does have F and f as suffixes
    to designate float values as distinct from double or long double.
    --
    "Any sufficiently advanced bug is indistinguishable from a feature."
    -- Rich Kulawiec
    Walter Roberson, Mar 4, 2008
    #3
  4. Ioannis Vranos

    Eric Sosman Guest

    Ioannis Vranos wrote:
    > AFAIK, there aren't any character designations for short and unsigned
    > short literals, like UL/ul are for unsigned long literals, under
    > C90/C95, right?


    Right. There's no literal whose type is any flavor of
    short or of char, or of anything else of lower rank than int.

    --
    Eric Sosman, Mar 4, 2008
    #4
  5. In article <1204670350.225716@news1nwk>,
    Eric Sosman <> wrote:
    >Ioannis Vranos wrote:
    >> AFAIK, there aren't any character designations for short and unsigned
    >> short literals, like UL/ul are for unsigned long literals, under
    >> C90/C95, right?


    > Right. There's no literal whose type is any flavor of
    >short or of char, or of anything else of lower rank than int.


    There is the L prefix for wide char and wide string.

    L'\123'
    L"xyz"

    C89 3.1.3.4 and C89 3.1.4
    --
    "The art of storytelling is reaching its end because the epic
    side of truth, wisdom, is dying out." -- Walter Benjamin
    Walter Roberson, Mar 4, 2008
    #5
  6. Ioannis Vranos

    Eric Sosman Guest

    Walter Roberson wrote:
    > In article <1204670350.225716@news1nwk>,
    > Eric Sosman <> wrote:
    >> Ioannis Vranos wrote:
    >>> AFAIK, there aren't any character designations for short and unsigned
    >>> short literals, like UL/ul are for unsigned long literals, under
    >>> C90/C95, right?

    >
    >> Right. There's no literal whose type is any flavor of
    >> short or of char, or of anything else of lower rank than int.

    >
    > There is the L prefix for wide char and wide string.
    >
    > L'\123'
    > L"xyz"
    >
    > C89 3.1.3.4 and C89 3.1.4


    Thanks; I had forgotten wide char. As for wide string,
    though, the literal (if not used as an initializer) has the
    type `array[N] of wchar_t', and the array does not have rank.

    --
    Eric Sosman
    lid
    Eric Sosman, Mar 5, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Goche
    Replies:
    8
    Views:
    16,426
  2. Replies:
    4
    Views:
    802
    Kaz Kylheku
    Oct 17, 2006
  3. Michael B Allen

    I want unsigned char * string literals

    Michael B Allen, Jul 22, 2007, in forum: C Programming
    Replies:
    43
    Views:
    1,345
    David Thompson
    Aug 26, 2007
  4. fancyerii
    Replies:
    21
    Views:
    1,446
    Roedy Green
    Nov 5, 2007
  5. pozz
    Replies:
    12
    Views:
    722
    Tim Rentsch
    Mar 20, 2011
Loading...

Share This Page