This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
RE: Global constants
- From: "Stone, Joshua I" <joshua dot i dot stone at intel dot com>
- To: "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: <systemtap at sourceware dot org>, "Mark McLoughlin" <markmc at redhat dot com>
- Date: Mon, 13 Feb 2006 12:12:47 -0800
- Subject: 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