Question

Is there a convention for the order of (height, width) in function arguments or when displaying dimensions?

Was it helpful?

Solution

I don't know a huge number of languages, but what I have used go with (width, height). It's more fitting along the lines of (x, y) coordinates.

OTHER TIPS

I'd say (width, height) is overwhelmingly more common. It never hurts to make it explicit though (through argument naming, etc)

I don’t know if there is a convention elsewhere but personally I always use the convention used by graphics (usually even outside of computing, e.g. in photography): width before height.

The (width, height) seems to be more common all around.

it is exactly width-height

In the door and up the stairs. That's the mnemonic I was taught for map co-ordinates.

Display resolution is also normally quoted in "width × height".

Wikipedia link to Display Resolution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top