Skip to content

Commit

Permalink
Deprecate zero and one for Ptr{T}
Browse files Browse the repository at this point in the history
They doesn't fulfill the documentation for zero and one about additive
and multiplicative identity.

See discussion in
JuliaLang#6183 (comment)
  • Loading branch information
ivarne authored and waTeim committed Nov 23, 2014
1 parent 0cf295e commit c80ce83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
11 changes: 4 additions & 7 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,7 @@ end
export String
const String = AbstractString

export Uint, Uint8, Uint16, Uint32, Uint64, Uint128
const Uint = UInt
const Uint8 = UInt8
const Uint16 = UInt16
const Uint32 = UInt32
const Uint64 = UInt64
const Uint128 = UInt128
@deprecate zero{T}(::Type{Ptr{T}}) Ptr{T}(0)
@deprecate zero{T}(x::Ptr{T}) Ptr{T}(0)
@deprecate one{T}(::Type{Ptr{T}}) Ptr{T}(1)
@deprecate one{T}(x::Ptr{T}) Ptr{T}(1)
5 changes: 0 additions & 5 deletions base/pointer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,3 @@ eltype{T}(::Ptr{T}) = T
+(x::Ptr, y::Integer) = oftype(x, (uint(x) + (y % UInt) % UInt))
-(x::Ptr, y::Integer) = oftype(x, (uint(x) - (y % UInt) % UInt))
+(x::Integer, y::Ptr) = y + x

zero{T}(::Type{Ptr{T}}) = convert(Ptr{T}, 0)
zero{T}(x::Ptr{T}) = convert(Ptr{T}, 0)
one{T}(::Type{Ptr{T}}) = convert(Ptr{T}, 1)
one{T}(x::Ptr{T}) = convert(Ptr{T}, 1)

0 comments on commit c80ce83

Please sign in to comment.