Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If the code base supports designated initializers I'll use them as a way of getting named parameters like so:

struct SomeArgs { bool normalize{false}; int stride{2}; char ch{'x'}; ... some other stuff };

void someFn(SomeArgs args);

someFn({ .stride = 1, .ch = 'y' }); someFn({ .normalize = true });

not as simple as python but it's close-ish and more readable than: someFn(false, 2, 'c');



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: