Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8046463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:47:37+00:00 2026-06-05T05:47:37+00:00

As an example to clarify my question, in Google Go 1.0, the following interface

  • 0

As an example to clarify my question, in Google Go 1.0, the following interface is defined in the “io” package:

type Reader interface {
    Read(p []byte) (n int, err error)
}

Especially the result parameter list (n int, err error) intrigues me. Intrinsically the number of bytes can not be negative, according to the documentation of the interface:

It returns the number of bytes read (0 <= n <= len(p))[…]

In C the reason to use int was the in-band value -1 to signal an error condition (see Effective Go: Multiple return values). Because of multiple return values, special in-band values are not necessary.

There exists the type uint in Go 1.0.

What is the specific reason for using int versus uint in the case of values that only use the positive range [0,∞) without the need for having special in-band values?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:47:38+00:00Added an answer on June 5, 2026 at 5:47 am

    The de facto numeric type for integers in most cases is int. For example, len(x) and cap(x) return int values even though those too cannot be negative. In most cases returning an int helps avoid type conversions between different numeric types.

    So yes, Read() could have returned a uint, but this would make it slightly more unwieldy to work with.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE to clarify the question... In attempting google drive example app Dr edit for
IOS/IB Question - To clarify my question I'll use the following example. I created
To clarify my question, let's start off with an example program: #include <stdio.h> #pragma
Example code: List<Student> Students = new List<Student>() { new Student(101, Hugo, Garcia, new List<int>()
Let me clarify my question, and the solution I'm looking for. I'm using wikispaces.com,
Fixed issues with the code. Ok, I think I need to clarify the question.
A different question inspired the following thought: Does std::vector<T> have to move all the
UPDATED entire question to clarify things. Software Team Foundation Server 2010. Background Some while
Note: To clarify, the question is not about the use of the restrict keyword
How is data stored when read in using fstream class ? An example will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.