Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pike pike
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 104
    • Issues 104
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pikelang
  • pikepike
  • Issues
  • #1656
Closed
Open
Issue created May 15, 2001 by Peter Bortas@zinoOwner

More documentation regarding zero_type/void/intp is needed

Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=1656

Reference: http://pike.roxen.com/documentation/tutorial/tutorial_4.html#4.1.1

Reported by Petter Isaksson, petter.isaksson@home.se

How and when to use zero_type is far from obvious, I just stumbled upon the following:

Pike v7.0 release 304 running Hilfe v2.0 (Incremental Pike Frontend)
> int testfun(string s, void|int i)
>> {
>> if (zero_type(i)) write("i is zero_type");
>> if (intp(i)) write("\n i is integer\n");
>> }
> testfun("a");
i is zero_type
 i is integer
Result: 0
> testfun("a",17);

i is integer Result: 0

For me, when writing a function like foo(int|void arg), the obvious choice is to pick intp() to check if arg is supplied or not, and the result is certainly not the expected.

Or perhaps this is a bug in (the documentation of) intp()? :) (See url)

Assignee
Assign to
Time tracking