What style checking does -gnatyo actually perform?Ada: package does not allow a bodyAda index check failedWhat is the difference between the Adacore Gnat version and the “standard” oneWhat does “no selector” mean?Ada DLL causes Seg Fault in system.secondary_stack.ss_markWhat caused this Ada compilation error “ambiguous character literal”?DllMain/DllMainCRTStartup does not execute in DLLAda deferred constant finalized using complicated calculation; where to put the code?What is “libgnarl”?GPRBuild does not compile C files
Are the related objects in an SOQL query shared?
In MTG, was there ever a five-color deck that worked well?
A Checkmate of Dubious Legality
“The Fourier transform cannot measure two phases at the same frequency.” Why not?
Are valid inequalities worth the effort given modern solver preprocessing options?
How does Rust's 128-bit integer `i128` work on a 64-bit system?
Conditional probability of dependent random variables
What's "halachic" about "Esav hates Ya'akov"?
Did Logical Positivism fail because it simply denied human emotion?
Broken bottom bracket?
Why does putting a dot after the URL remove login information?
Would the shaking of an earthquake be visible to somebody in a low-flying aircraft?
Variable doesn't parse as string
Write The Shortest Program To Check If A Binary Tree Is Balanced
Four-velocity of radially infalling gas in Schwarzschild metric
Piece de Resistance - Introduction & Ace and A's
Movie with a girl/fairy who was talking to a unicorn in a snow covered forest
Pronouns when writing from the point of view of a robot
What is the right Bonferroni adjustment?
Write The Shortest Program to Calculate Height of a Binary Tree
Is it uncompelling to continue the story with lower stakes?
How do I know when and if a character requires a backstory?
Is the first page of a novel really that important?
What is it exactly about flying a Flyboard across the English channel that made Zapata's thighs burn?
What style checking does -gnatyo actually perform?
Ada: package does not allow a bodyAda index check failedWhat is the difference between the Adacore Gnat version and the “standard” oneWhat does “no selector” mean?Ada DLL causes Seg Fault in system.secondary_stack.ss_markWhat caused this Ada compilation error “ambiguous character literal”?DllMain/DllMainCRTStartup does not execute in DLLAda deferred constant finalized using complicated calculation; where to put the code?What is “libgnarl”?GPRBuild does not compile C files
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
The manual reads:
Check order of subprogram bodies. If the letter o appears in the string after -gnaty then all subprogram bodies in a given scope (e.g. a package body) must be in alphabetical order. The ordering rule uses normal Ada rules for comparing strings, ignoring casing of letters, except that if there is a trailing numeric suffix, then the value of this suffix is used in the ordering (e.g. Junk2 comes before Junk10).
I take it that Junk2
coming for Junk10
is the actual inspiration for an otherwise odd style enforcement. But what's an example of some code that actually triggers it? I couldn't get this option to complain with disordered function definitions or task bodies. For example, I get no complaints when compiling the following with gnat make -gnatyo
:
procedure Disordered is
function Test return Natural;
function Zest return Natural;
-- disordered function bodies
function Zest return Natural is (1);
function Test return Natural is (2);
begin
null;
end Disordered;
ada gnat
add a comment |
The manual reads:
Check order of subprogram bodies. If the letter o appears in the string after -gnaty then all subprogram bodies in a given scope (e.g. a package body) must be in alphabetical order. The ordering rule uses normal Ada rules for comparing strings, ignoring casing of letters, except that if there is a trailing numeric suffix, then the value of this suffix is used in the ordering (e.g. Junk2 comes before Junk10).
I take it that Junk2
coming for Junk10
is the actual inspiration for an otherwise odd style enforcement. But what's an example of some code that actually triggers it? I couldn't get this option to complain with disordered function definitions or task bodies. For example, I get no complaints when compiling the following with gnat make -gnatyo
:
procedure Disordered is
function Test return Natural;
function Zest return Natural;
-- disordered function bodies
function Zest return Natural is (1);
function Test return Natural is (2);
begin
null;
end Disordered;
ada gnat
add a comment |
The manual reads:
Check order of subprogram bodies. If the letter o appears in the string after -gnaty then all subprogram bodies in a given scope (e.g. a package body) must be in alphabetical order. The ordering rule uses normal Ada rules for comparing strings, ignoring casing of letters, except that if there is a trailing numeric suffix, then the value of this suffix is used in the ordering (e.g. Junk2 comes before Junk10).
I take it that Junk2
coming for Junk10
is the actual inspiration for an otherwise odd style enforcement. But what's an example of some code that actually triggers it? I couldn't get this option to complain with disordered function definitions or task bodies. For example, I get no complaints when compiling the following with gnat make -gnatyo
:
procedure Disordered is
function Test return Natural;
function Zest return Natural;
-- disordered function bodies
function Zest return Natural is (1);
function Test return Natural is (2);
begin
null;
end Disordered;
ada gnat
The manual reads:
Check order of subprogram bodies. If the letter o appears in the string after -gnaty then all subprogram bodies in a given scope (e.g. a package body) must be in alphabetical order. The ordering rule uses normal Ada rules for comparing strings, ignoring casing of letters, except that if there is a trailing numeric suffix, then the value of this suffix is used in the ordering (e.g. Junk2 comes before Junk10).
I take it that Junk2
coming for Junk10
is the actual inspiration for an otherwise odd style enforcement. But what's an example of some code that actually triggers it? I couldn't get this option to complain with disordered function definitions or task bodies. For example, I get no complaints when compiling the following with gnat make -gnatyo
:
procedure Disordered is
function Test return Natural;
function Zest return Natural;
-- disordered function bodies
function Zest return Natural is (1);
function Test return Natural is (2);
begin
null;
end Disordered;
ada gnat
ada gnat
edited Mar 27 at 8:07
egilhh
4,2571 gold badge11 silver badges18 bronze badges
4,2571 gold badge11 silver badges18 bronze badges
asked Mar 27 at 2:41
Julian FondrenJulian Fondren
4,40913 silver badges26 bronze badges
4,40913 silver badges26 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You have:
-- disordered function bodies
function Zest return Natural is (1);
function Test return Natural is (2);
but technically, these are not subprogram bodies. They are called expression functions. The reason for this clear separation is that subprogram bodies are not allowed in package specifications, whereas expression functions are.
Using actual subprogram bodies in your example will give the expected style warning:
function Zest return Natural is
begin
return 1;
end Zest;
function Test return Natural is
begin
return 2;
end Test;
(and since you mentioned task bodies; those are also not subprogram bodies)
I think that not requiring ordering of expression functions might be an oversight
– Simon Wright
Mar 27 at 11:32
Maybe. The style check was definitely implemented before expression functions existed, so there's a fair chance... However,that would possibly require them to always be completions of previous declarations, as they could have inter-dependencies requiring a different ordering
– egilhh
Mar 27 at 12:25
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368994%2fwhat-style-checking-does-gnatyo-actually-perform%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have:
-- disordered function bodies
function Zest return Natural is (1);
function Test return Natural is (2);
but technically, these are not subprogram bodies. They are called expression functions. The reason for this clear separation is that subprogram bodies are not allowed in package specifications, whereas expression functions are.
Using actual subprogram bodies in your example will give the expected style warning:
function Zest return Natural is
begin
return 1;
end Zest;
function Test return Natural is
begin
return 2;
end Test;
(and since you mentioned task bodies; those are also not subprogram bodies)
I think that not requiring ordering of expression functions might be an oversight
– Simon Wright
Mar 27 at 11:32
Maybe. The style check was definitely implemented before expression functions existed, so there's a fair chance... However,that would possibly require them to always be completions of previous declarations, as they could have inter-dependencies requiring a different ordering
– egilhh
Mar 27 at 12:25
add a comment |
You have:
-- disordered function bodies
function Zest return Natural is (1);
function Test return Natural is (2);
but technically, these are not subprogram bodies. They are called expression functions. The reason for this clear separation is that subprogram bodies are not allowed in package specifications, whereas expression functions are.
Using actual subprogram bodies in your example will give the expected style warning:
function Zest return Natural is
begin
return 1;
end Zest;
function Test return Natural is
begin
return 2;
end Test;
(and since you mentioned task bodies; those are also not subprogram bodies)
I think that not requiring ordering of expression functions might be an oversight
– Simon Wright
Mar 27 at 11:32
Maybe. The style check was definitely implemented before expression functions existed, so there's a fair chance... However,that would possibly require them to always be completions of previous declarations, as they could have inter-dependencies requiring a different ordering
– egilhh
Mar 27 at 12:25
add a comment |
You have:
-- disordered function bodies
function Zest return Natural is (1);
function Test return Natural is (2);
but technically, these are not subprogram bodies. They are called expression functions. The reason for this clear separation is that subprogram bodies are not allowed in package specifications, whereas expression functions are.
Using actual subprogram bodies in your example will give the expected style warning:
function Zest return Natural is
begin
return 1;
end Zest;
function Test return Natural is
begin
return 2;
end Test;
(and since you mentioned task bodies; those are also not subprogram bodies)
You have:
-- disordered function bodies
function Zest return Natural is (1);
function Test return Natural is (2);
but technically, these are not subprogram bodies. They are called expression functions. The reason for this clear separation is that subprogram bodies are not allowed in package specifications, whereas expression functions are.
Using actual subprogram bodies in your example will give the expected style warning:
function Zest return Natural is
begin
return 1;
end Zest;
function Test return Natural is
begin
return 2;
end Test;
(and since you mentioned task bodies; those are also not subprogram bodies)
answered Mar 27 at 8:06
egilhhegilhh
4,2571 gold badge11 silver badges18 bronze badges
4,2571 gold badge11 silver badges18 bronze badges
I think that not requiring ordering of expression functions might be an oversight
– Simon Wright
Mar 27 at 11:32
Maybe. The style check was definitely implemented before expression functions existed, so there's a fair chance... However,that would possibly require them to always be completions of previous declarations, as they could have inter-dependencies requiring a different ordering
– egilhh
Mar 27 at 12:25
add a comment |
I think that not requiring ordering of expression functions might be an oversight
– Simon Wright
Mar 27 at 11:32
Maybe. The style check was definitely implemented before expression functions existed, so there's a fair chance... However,that would possibly require them to always be completions of previous declarations, as they could have inter-dependencies requiring a different ordering
– egilhh
Mar 27 at 12:25
I think that not requiring ordering of expression functions might be an oversight
– Simon Wright
Mar 27 at 11:32
I think that not requiring ordering of expression functions might be an oversight
– Simon Wright
Mar 27 at 11:32
Maybe. The style check was definitely implemented before expression functions existed, so there's a fair chance... However,that would possibly require them to always be completions of previous declarations, as they could have inter-dependencies requiring a different ordering
– egilhh
Mar 27 at 12:25
Maybe. The style check was definitely implemented before expression functions existed, so there's a fair chance... However,that would possibly require them to always be completions of previous declarations, as they could have inter-dependencies requiring a different ordering
– egilhh
Mar 27 at 12:25
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368994%2fwhat-style-checking-does-gnatyo-actually-perform%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown