Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. JasonWB007

    Pointers to constants?

    Well, I wrote the function also, so I can change if, if need be. For the READ case, this pointer holds the return value. For the WRITE case, this variable is the pointer to the data we wish to write. For the CLEAR case, it is ignored. So, this should work: status = EEPROM_IO(0, (void *)0...
  2. JasonWB007

    Pointers to constants?

    That is what I have done. But it seems a waste of a variable and for some reason, the "(void *)0" seems to work. Do you know what it actually is doing? Am I just getting lucky?
  3. JasonWB007

    Pointers to constants?

    The function itself is defined as: int EEPROM_IO(unsigned int addr, unsigned int *dataptr, unsigned int len, int dir); The variable "dataptr" is used to hold the returned value when the EEPROM is read, but when written, sometimes it would be very useful (clearing the EEPROM, for example)...
  4. JasonWB007

    Pointers to constants?

    Hi, Looking through some code, I found a function of the format: int function (parms..., (void *)0, parms...); Is this legal? I have a need to pass a constant to a function and I really don't want to define a variable to hold it. I have a function that will either read or write a device...
  5. JasonWB007

    What is the best external interface for a library file?

    Hi all, I am in the process of reworking some of my code so that some of the more resuable functions are collected into libraries that will be linked in with multiple applications. One of these functions is a serial port driver and the way it is set up, it requires access to several flags and...
  6. JasonWB007

    "Proper" way to declare functions

    Thanks for all the replies. I think I like option #2.5 as well. However, I have always tried to keep one header file with one C file - it sounds like you are implying that this is not the best case? I don't quite know what you mean by "subsystem root", though. Could you explain? Also, the...
  7. JasonWB007

    "Proper" way to declare functions

    Hi everyone, I hope this isn't too elementary for everyone, but what is the absolute strictest "proper" way to declare a C function and to access it in a separate file? Assume I have been sent to a military Catholic school for C programmers :-) (Actually, we're looking at DO-178, something...
  8. JasonWB007

    Standard format

    Sorry, about the original post - I think I was less than clear. I ONLY an referring to a constant declaration. The reason I ask is that our coding standards for DO-178B recommend using "const" over "#define" and I had always used all caps for #define, but not const. This is probably a very...
  9. JasonWB007

    Standard format

    Hi everyone, Please forgive the simple question, but if I have a declaration, such as: const int UPPER_LIMIT = 127; is the *best* policy to have it in caps? I usually do it in: #define UPPER_LIMIT 127 and am wondering if the same thing should apply to a const variable? Thoughts? Jason
  10. JasonWB007

    #define vs. const

    Thanks for the reply. I will probably put the #define as you show. Please note that I am not intentionally *limiting* the scope, I just like having it physically close together. My question, I guess, was more about what is "proper" programming procedure and if: int function(int var) #define...
  11. JasonWB007

    #define vs. const

    Hi everyone, Sometimes, I have need for a #define that really only applies to a single subroutine, so I would like to keep it with that routine. In general, I believe that #defines go at the top of a C file, so is there a good "proper" way to place the #define within the C routine? Should I...
  12. JasonWB007

    How to access and array of strings

    OK, thanks. Sorry for the confusion! I do appreciate your replies. Jason
  13. JasonWB007

    How to access and array of strings

    OK, I think I am getting closer to figuring this out - thanks! But if I am right, this declares an array of 10 pointers. What I want to do is declare a "pointer to an array of character arrays, each of which is 10 characters (max) long". The idea being I would like to store a single pointer...
  14. JasonWB007

    How to access and array of strings

    Hi everyone, Sorry if this is too simple, but I am trying to figure out how to access an array of strings, using an index for the string. I have: typedef struct { PARMTYPE parmtype; _iq* parmptr; int num_indices; const char *(indices[10]); // const char *indices; } PARMTAB; and I...

Part and Inventory Search

Back
Top