You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a pattern in the codebase when a list of nodes is iterated and the type of each of the nodes is equal and known. This is for example to iterate over lists of pins, etc.
This introduces a macro ASTNODE_ITERATE that has three parameters:
type: Is the type of the nodes (Ast is the matching class name)
it: Name of the iterator variable
init: Initialization statement for iterator
All occurrences of this pattern have been accordingly replaced:
for (Ast<type> *<it> = <init>; <it>; <it>=<it>->nextp()->cast<type>())
This improves readability and some time in the future this may be a good marker to replace data containers or similar.
The text was updated successfully, but these errors were encountered:
Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-05-06T14:26:08Z
For the time being I don't think we want to change this, but I appreciate your efforts to clean up and in general expect to accept other cleanups.
There's two main concerns. First, it makes the code harder to read for people not familiar with the code - if there was thousands it might be worth it but not for only 58. Second, in a few years once C++11 compilers are common (not yet), we can use the C++11 for loop syntax ("for (AstFoo* itp : nodep->itemsp()") for this and a lot of other things.
Author Name: Stefan Wallentowitz (@wallento)
Original Redmine Issue: 1304 from https://www.veripool.org
There is a pattern in the codebase when a list of nodes is iterated and the type of each of the nodes is equal and known. This is for example to iterate over lists of pins, etc.
This introduces a macro ASTNODE_ITERATE that has three parameters:
type: Is the type of the nodes (Ast is the matching class name)
it: Name of the iterator variable
init: Initialization statement for iterator
All occurrences of this pattern have been accordingly replaced:
This improves readability and some time in the future this may be a good marker to replace data containers or similar.
The text was updated successfully, but these errors were encountered: