Welcome to MSDN Blogs Sign in | Join | Help

Why are some GDI functions named ExtXxx instead of XxxEx?

By convention, an enhanced version of a function Xxx is called XxxEx, but there are many GDI functions that don't follow this conventions, most notably ExtTextOut, which should have been named TextOutEx under the XxxEx convention. Why don't the GDI functions follow that convention?

Because they were named before the XxxEx convention was established.

Nothing nefarious, just an artifact of history.

Published Friday, May 30, 2008 7:00 AM by oldnewthing
Filed under:

Comments

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 10:16 AM by Florian

And besides, ExtTextOut just sounds cute.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 10:27 AM by waleri

If this API be extended further, it will be named ExtTextOutEx? :)

No, seriously, is there any Ex API extended even more?

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 10:56 AM by Somebody who doesn't actually care

"they were named before the XxxEx convention was established"

So why establish a convention contrary to existing practice? It's like, you know, reading the contract from the other side, or something.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 11:13 AM by bob

"So why establish a convention contrary to existing practice?"

Because there were multiple existing practices and its better to choose the "correct" convention to standardize on rather than pick something just because it exists?

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 12:07 PM by AC

> No, seriously, is there any Ex API extended even more?

A recent example is the addition of IInternetSecurityManagerEx in WinXP SP2 and then IInternetSecurityManagerEx2 in IE7.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 12:25 PM by SRS

I say bring back 'Presto' as a standard convention.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 12:56 PM by Leo Davidson

"So why establish a convention contrary to existing practice?"

Adding the -Ex suffix is much better than adding the Ext- prefix because it keeps closely related functions together in alphabetically sorted indices (or "indexes" if you prefer).

My guess is that the problem with Ext- prefixes quickly became apparent as the Windows API documentation grew and became more organised, although I wasn't there and may be wrong.

(Of course, MSDN could use a special sorting algorithm on its index but why go to that trouble just to preserve a convention that hasn't been used much and is of little other consequence?)

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 1:02 PM by Anonymous

> No, seriously, is there any Ex API extended even more?

EnumCalendarInfoExEx and EnumDateFormatsExEx in Vista. Basically, they just add a "context" parameter to their callback functions.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 2:53 PM by JohnW

> EnumCalendarInfoExEx and EnumDateFormatsExEx in Vista.

Ugh.  Should just have done EnumCalendarInfoEx2. Otherwise, we'll be looking at EnumCalendarInfoExExExExExEx one day.

Maybe the assumption is that it'll be entirely deprecated before that insanity kicks in.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 4:35 PM by tcliu

The DirectX team has the best solution, in my opinion: IDirect3D, IDirect3D2, ..., IDirect3Dx with x being the interface version.

Simple, understandable, and avoids the -Ex suffix which only works once and must then be turned into ExX with X being the version anyway.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 4:47 PM by Niels

IIRC many of the -Ex functions instead of a regular parameter list takes a pointer to a struct with parameters, and often the first field of that struct is a "size of struct" one. This essentially makes it possible to use the size field as a "version" field and upgrade the struct without changing the function, and let newer implementations of the function accept several versions of the struct.

Although I'm not sure what an older implementation of the function should do if it receives an unknown version of the struct.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Friday, May 30, 2008 7:31 PM by Bruno

"Although I'm not sure what an older implementation of the function should do if it receives an unknown version of the struct."

Fail with the appropriate error code. I don't know offhand what the appropriate Win32 error code is though.

# なんで、GDI 関数は XxxEx じゃなくて ExtXxx なん?

Saturday, May 31, 2008 3:54 AM by 囚人のジレンマな日々

なんで、GDI 関数は XxxEx じゃなくて ExtXxx なん?

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Saturday, May 31, 2008 4:26 AM by Narr

>let newer implementations of the function accept several versions of the struct.

Good luck with that. I think Raymond has covered many cases where that can't be done because some big names didn't understand the size field.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Saturday, May 31, 2008 2:40 PM by Yuhong Bao

BTW, which version of Windows added ExtTextOut?

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Saturday, May 31, 2008 2:44 PM by waleri

I think newer implementations *do* accept several versions of the struct. Otherwise, applications written with an older SDK will fail to run ot newer OS versions.

# Real reason...

Sunday, June 01, 2008 1:31 AM by Igor Levicki

I think the real reason is that too many GDI function names ended with letter "s" ;)

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Sunday, June 01, 2008 9:48 PM by Yuhong Bao

>I think the real reason is that too many GDI function names ended with letter "s" ;)

But not ExtTextOut, so...

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Monday, June 02, 2008 11:14 AM by James

Narr: That works fine provided the very first implementation (and subsequent ones, of course) enforce the size value. Then, any code which passes an incorrect size value will never have worked anyway, neatly avoiding the need to compensate for author incompetence there.

# re: Why are some GDI functions named ExtXxx instead of XxxEx?

Monday, June 02, 2008 7:06 PM by Jolyon Smith

Q: "So why establish a convention contrary to existing practice?"

A: "Because there were multiple existing practices and its better to choose the "correct" convention to standardize on rather than pick something just because it exists?"

Except of course that there was no standardization, only the establishment of a convention to be applied in the future.

The existing inconsistencies remain(ed).

# ?????????????????? ?? ?????????????????? ?? ???????????????????????? ???????????? ?? Windows 7 | ???????? ?? Windows 7

New Comments to this post are disabled
 
Page view tracker