This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Global constants


Frank Ch. Eigler wrote:
> The code doesn't need the { } around the printf, and the printf
> doesn't need a semicolon.

Of course this is a matter of coding style, not correctness.  By always
including semicolons and braces, you eliminate ambiguity.  I find it
unfortunate that the language is designed such that the semicolon is
"usually-not but sometimes" needed.

> Perhaps probes consisting of a single statement shouldn't require
> the outer braces either:
>     probe kernel.function ("sys_open") if ($flags & O_CREAT) printf
> ("foo\n") 

I have a negative gut reaction to this as well.  I think if you remove
the braces you start to lose the distinction between a probe declaration
and a statement.  The difference is significant, as only the latter is a
sequential entity.

People moving from conventional programming languages to hardware
languages like VHDL or Verilog are often surprised by the non-sequential
execution.  With the probes in SystemTap, we're not too dissimilar -
probes may fire at any time, completely independent of each other.  I
think we need to enforce some notion that a probe is its own entity, and
the braces do that nicely.


Josh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]