× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




I also use Like and LikeDS to define new data types, though ideally I
would like to have a keyword that specifically indicated that a field or
data structure was only being used as a definition. This could prevent
the data type definitions from accidently being used, and prevent the
space for them from being wasted.

I agree. Though, I think BASED(TEMPLATE) works pretty well for that, I'd much rather see something that's specifically designed for it.


Though in most cases the waste of space is negligible, and if you are really worried about it the based trick will prevent even that. What I don't like about the based trick is that it doesn't tell me if the variable is a data type definition, or if it is actually going to be used as a based variable.

That's why I use a name like 'TEMPLATE' for the pointer. Or, if my fingers aren't too tired, I might do something like:


          BASED(TEMPLATE_ONLY)

I don't think it's very likely that someone will think that memory is being allocated to a variable named TEMPLATE_ONLY... Though, I do agree that something that's specifically designed for this would be a little nicer.

Similarly without some kind of "standard", which will vary from shop to shop, or comments in the code, and how many people put as many of those in as they should, there is no way to tell the programmer that "addressDS" or "address_T" or "address*" is a data type not an actual variable.

I agree. Though the '_T' convention is very commonly used in C on all platforms. For example 'size_t' or 'in_addr_t'. Many compilers and/or operating systems come with #include files for C (like /copy files for RPG) that contain that suffix meaning "data type"


Although it's not a standard in RPG, it'd be really nice if it were :)

But, yeah, again I like the idea of having a keyword that's specifically designed for this -- but I don't think the current method is a show stopper. It works well and is a lot better than forcing the caller to define his own definitions in every program...


As for specifying the length of a variable, I was only suggesting it
for the compiler defined types. Since it would be extremely annoying to
have only some of the basic data types available from built in Like
definitions.

Maybe when they create free format D-specs, they'll allow us to specify names like 'char' or 'int' or 'varying' instead of the letters?


Of course, at some point you say to yourself, "Why don't I just code it in C in the first place?"


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.