1

It seems queue.size() can also be written as queue.size and it also works. Is there any difference?

Does that mean that all functions and tasks can be used w/o parenthesis?

awill
  • 135
  • 1
  • 4
  • 15

1 Answers1

0

Are the same thing.

size is a function to know the queue dimension. You can write with parenthesis and without them.

You can see here and here

If you have a function without parameter you can ignore parenthesis (your case about size function)

Joe Taras
  • 15,166
  • 7
  • 42
  • 55
  • Does that mean that all functions and tasks can be used w/o parenthesis? – awill Nov 28 '14 at 08:28
  • If a function (like size) has no parameter you can ignore parenthesis. See here: http://books.google.it/books?id=QaWOYTOXy0EC&pg=PA72&lpg=PA72&dq=systemverilog+function+without+parentheses&source=bl&ots=Z1d-6FEDZN&sig=h9BCQBqBGiUG0S0Uhb-4KSDIdds&hl=it&sa=X&ei=CzN4VJTzE43oaJXwgeAN&ved=0CDMQ6AEwAg#v=onepage&q=systemverilog%20function%20without%20parentheses&f=false – Joe Taras Nov 28 '14 at 08:33
  • 4
    @awill I wouldn't recommend using `queue.size` even though the standard allows it. As you can see, it causes confusion as to whether `size` is a field or function. – Tudor Timi Nov 28 '14 at 11:06
  • 1
    @tudor another one of the random "features" of SystemVerilog that saves almost nothing and gives in return ambiguity and confusion :) – Chiggs Dec 02 '14 at 10:28