From: Simon Wright <simon@pushface.org>
Subject: Use of expression function in protected type
Date: Tue, 20 Jan 2015 22:34:53 +0000
Date: 2015-01-20T22:34:53+00:00 [thread overview]
Message-ID: <lylhkxnks2.fsf@pushface.org> (raw)
Is it permissible to use an expression function as the completion of a
protected function? (GNAT thinks so).
protected Button
is
function Current_Index return Interval_Index;
private
Index : Interval_Index := 0;
procedure Handler;
pragma Attach_Handler (Handler, Ada.Interrupts.Names.EXTI0_IRQ);
end Button;
and then
protected body Button is
function Current_Index return Interval_Index is (Index); -- <<<<<<<<
procedure Handler is
begin
HAL_GPIO_EXTI_IRQHandler (16#0001#);
Index := Index + 1;
end Handler;
end Button;
ARM 6.1(30) distinguishes an expression_function_declaration from a
subprogram_declaration.
6.8(4) allows an expression_function_declaration to be a completion.
9.4(8) says a protected_operation_item can be, inter alia, a
subprogram_declaration or a subprogram body. (subprogram_declaration?
how can that be?)
next reply other threads:[~2015-01-20 22:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-20 22:34 Simon Wright [this message]
2015-01-21 8:35 ` Use of expression function in protected type Egil H H
2015-01-21 9:15 ` Simon Wright
2015-01-21 20:44 ` Randy Brukardt
2015-01-22 2:50 ` Randy Brukardt
2015-01-22 18:05 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox