alexhall,

I think I'm becoming a fan of putting each function or method parameter on its own line. It takes up more space, but it's easier to review them one at a time, and I can move the order of parameters around simply by using my IDE's command for moving lines up and down.

TheQuinbox,

@alexhall Goodness, I could never. That would fall down very hard with something like ent(game_world@ w, float x, float y, float z, float width, float length, float height, uint64 flags = 0) {
Something I did write yesterday. There's a shorter version that uses vectors instead of 6 floats but even still, oh my. Glad it works for you, though.

jscholes,
@jscholes@dragonscave.space avatar

@TheQuinbox That's painful to read, no matter how many lines it's spread across. @alexhall

TheQuinbox,

@jscholes @alexhall It was painful to write too, I assure you. Made the end-user's code quite nice though.

matt,

@TheQuinbox @alexhall If you think that's long, the Win32 CreateProcess function (well, technically CreateProcessA or CreateProcessW) has 10 parameters. Back about 16 years ago, I think I got to where I could actually remember them in order. Now, I'd have to check.

TheQuinbox,

@matt @alexhall In one of the Win32 C++ projects I'm a part of, there's a comment that says this: // Runs an application with CreateProcess. Pretty much all the parameters of CreateProcess are useless and it's simply annoying to remember them, thus this function.

matt,

@TheQuinbox I've needed to use several of the CreateProcess parameters at different times. The two that I don't remember if I've ever used are lpProcessAttributes and lpThreadAttributes (and yes, I dislike the Petzold bastardization of Hungarian notation in that "lp" prefix).

matt,

@TheQuinbox Oh wait, I was wrong in that side note. Charles Petzold didn't originate that version of Hungarian notation, he just spread it. Joel Spolsky called it "systems Hungarian", and also thinks it was a bad thing. https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/

alexhall,

@TheQuinbox It would be a lot to arrow through, but wouldn't it be valid? I'm not sure what language that's in. It's the methods with longer parameter lists where I'm starting to like this. Two or three, sure toss them on one line, but six is easier on separate lines. If I want to review a class to find its public API, it's simpler to hear things broken up this way, for me. Of course, I prefer very verbose parameter names, so that makes single-line signatures way longer.

TheQuinbox,

@alexhall That's Angelscript. It's valid, but I just know that it would break my workflow, and I hate anything that does that. That's the same reason I haven't switched editors yet.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • rosin
  • thenastyranch
  • ethstaker
  • osvaldo12
  • mdbf
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • Youngstown
  • ngwrru68w68
  • slotface
  • GTA5RPClips
  • kavyap
  • cubers
  • JUstTest
  • everett
  • cisconetworking
  • tacticalgear
  • anitta
  • khanakhh
  • normalnudes
  • Durango
  • modclub
  • tester
  • provamag3
  • Leos
  • megavids
  • lostlight
  • All magazines