Advertisement
haykart

Untitled

Oct 12th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. void f(char c, signed char sc, unsigned char uc)
  2. {
  3.     char∗ pc = &uc; // error : no pointer conversion
  4.     signed char∗ psc = pc; // error : no pointer conversion
  5.     unsigned char∗ puc = pc; // error : no pointer conversion
  6.     psc = puc; // error : no pointer conversion
  7. }
  8. void g(char c, signed char sc, unsigned char uc)
  9. {
  10.     c = 255; // implementation-defined if plain chars are signed and have 8 bits
  11.     c = sc; // OK
  12.     c = uc; // implementation-defined if plain chars are signed and if uc’s value is too large
  13.     sc = uc; // implementation defined if uc’s value is too large
  14.     uc = sc; // OK: conversion to unsigned
  15.     sc = c; // implementation-defined if plain chars are unsigned and if c’s value is too large
  16.     uc = c; // OK: conversion to unsigned
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement