Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A quick review of usb.ads #1

Open
mgrojo opened this issue Oct 27, 2023 · 1 comment
Open

A quick review of usb.ads #1

mgrojo opened this issue Oct 27, 2023 · 1 comment

Comments

@mgrojo
Copy link

mgrojo commented Oct 27, 2023

use Ada.Containers;

A popular style is to put the use at the same line as the corresponding with.

(Device_Descriptor_Kind,

There's nothing wrong in repeating the type name in each enumeration value, but note that in Ada the identifier is not global; the same value could be repeated in another type and there wouldn't be a conflict. The repeated name can disambiguated when using it by context or explicitly by Type'(Value).

procedure Check_Error (Error_Code : Interfaces.C.int);

Are you sure this is needed in the private part of the specification? There are only two reasons to put something in the private part:

  • When it is required by the compiler as completion of something in the public part.
  • When you want to make something visible in the subsystem (child packages of this package), but not to external users of the package.
    You can leave it to the body, if it is only used there.

The indentation of broken lines looks too short to me, but that's a question of taste.

I only reviewed this specification, and the rest looks pretty good to me. Congratulations on your good progress learning Ada!

@joelreymont
Copy link
Owner

Completely missed your review @mgrojo. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants