Why should I use user defined data types?

bogosort

Joined Sep 24, 2011
696
I certainly don't want to always see what the actual data types are at the point of use within, for instance, the FILE abstract data type.
Disagreement warmly welcomed, but I did specifically say that user-defined types are a good thing for library APIs, e.g., FILE and clock_t.
 

WBahn

Joined Mar 31, 2012
32,834
Disagreement warmly welcomed, but I did specifically say that user-defined types are a good thing for library APIs, e.g., FILE and clock_t.
Yes, you did. Part of the point I was trying to make is that a lot of user-defined code is properly treated as library APIs.
 

BobaMosfet

Joined Jul 1, 2009
2,211
Now suppose that the calling routine has calculated the individual values. You then need to add this before the call:
P1.x = X1;
P1.y = Y1;
P2.x = X2;
P2.y = Y2;

then the call:
P = intersect(P1, P2);

Then after the call you need to extract the return values:
X = P.X;
Y = P.Y;

Now it doesn't look like much of an improvement.
Typically, once in a datatype, you use that datatype. Like using P.X instead of X.
 
Last edited:

MrSoftware

Joined Oct 29, 2013
2,273
Edit --> My message below was in response to a post that seems to have been deleted.

I do not believe it is accurate to say that Windows 10 is written in VB6. I would be more than a little surprised if any of the kernel or anything below ring 3 for that matter were written in VB. It's possible some of the higher level UI stuff could be written in the higher level languages such as VB, C#, etc.. but I would guess that most everything lower level is likely written in a mix of C, C++ and assembly.
 
Last edited:
Top