Skip to content

Commit

Permalink
update "noteworthy differences from C/C++"
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Oct 4, 2020
1 parent 44fcc0e commit 24d0b6d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions doc/src/manual/noteworthy-differences.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,18 @@ For users coming to Julia from R, these are some noteworthy differences:
a larger size type, such as `Int64` (if `Int` is `Int32`), `Int128`, or the arbitrarily large
`BigInt` type. There are no numeric literal suffixes, such as `L`, `LL`, `U`, `UL`, `ULL` to indicate
unsigned and/or signed vs. unsigned. Decimal literals are always signed, and hexadecimal literals
(which start with `0x` like C/C++), are unsigned. Hexadecimal literals also, unlike C/C++/Java
(which start with `0x` like C/C++), are unsigned, unless when they encode more than 128 bits,
in which case they are of type ``BigInt``. Hexadecimal literals also, unlike C/C++/Java
and unlike decimal literals in Julia, have a type based on the *length* of the literal, including
leading 0s. For example, `0x0` and `0x00` have type [`UInt8`](@ref), `0x000` and `0x0000` have type
[`UInt16`](@ref), then literals with 5 to 8 hex digits have type `UInt32`, 9 to 16 hex digits type
`UInt64` and 17 to 32 hex digits type `UInt128`. This needs to be taken into account when defining
`UInt64`, 17 to 32 hex digits type `UInt128`, and more that 32 hex digits type `BigInt`.
This needs to be taken into account when defining
hexadecimal masks, for example `~0xf == 0xf0` is very different from `~0x000f == 0xfff0`. 64 bit `Float64`
and 32 bit [`Float32`](@ref) bit literals are expressed as `1.0` and `1.0f0` respectively. Floating point
literals are rounded (and not promoted to the `BigFloat` type) if they can not be exactly represented.
Floating point literals are closer in behavior to C/C++. Octal (prefixed with `0o`) and binary
(prefixed with `0b`) literals are also treated as unsigned.
(prefixed with `0b`) literals are also treated as unsigned (or `BigInt` for more than 128 bits).
* String literals can be delimited with either `"` or `"""`, `"""` delimited literals can contain
`"` characters without quoting it like `"\""`. String literals can have values of other variables
or expressions interpolated into them, indicated by `$variablename` or `$(expression)`, which
Expand Down

0 comments on commit 24d0b6d

Please sign in to comment.