Created
September 16, 2013 06:55
-
-
Save zeroeth/6577384 to your computer and use it in GitHub Desktop.
Looking at ways of creating named parameters in C/C++ that's aesthetically pleasing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* TYPE 1 */ | |
| Spot left_spot = Spot (/* eye: */ 0, /* position: */ 5, /* width: */ 3, /* color: */ led_strip.Color (5, 0, 0)); | |
| /* TYPE 2 */ | |
| Spot left_spot = Spot ( /* eye */ 0, | |
| /* position */ 5, | |
| /* width */ 3, | |
| /* color */ led_strip.Color (5, 0, 0)); | |
| /* TYPE 3 */ | |
| Spot left_spot; | |
| void setup () | |
| { | |
| left_spot.eye = 0; | |
| left_spot.position = 5; | |
| left_spot.width = 3; | |
| left_spot.color = led_strip.Color ( 5, 0, 0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment