0

I have found in my project a type definition, which is definitely from a standard library. Lets say the definition is called

uint64_t

I know

#include <stdint.h>
#include <string.h>
#include <stdarg.h>

are included. Now instead of searching through my root directory path like I used to do e.g.

find / | grep stdint.h

I want to do something more efficient. I've seen in the past people using some unusual gcc flags to find the definition lines and stuff. And I really can't see through the gcc online docs...

closed as unclear what you're asking by Rui F Ribeiro, Thomas Dickey, Mr Shunz, Archemar, Thomas Jan 16 at 18:30

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    yes it goes in that direction, gcc -E is the actual flag I'm searching (mentioned in your link). It stops the compiler after preprocessor stage and outputs the actual includes and type definitions without all the #ifdef's to stdout. – Oliver Al-Hassani Jan 15 at 16:38
2

If we were looking for the definition of an uint64 in my 64bit Debian system this is the command I was looking for:

echo | gcc -E -xc -include stdint.h -include stddef.h - | grep uint64_t

outputs

typedef unsigned long int uint64_t;

Probably this command is lurking around here and there, but I couldn't find it implicitly.

  • 1
    Note that this finds the standard uint64_t type, not some unknown uint64 type. – Kusalananda Jan 15 at 17:10
  • Oh yes, I meant uint64_t – Oliver Al-Hassani Jan 15 at 17:16
  • That type is, per the C standard, defined in stdint.h. Why do you need to search for it? – Kusalananda Jan 15 at 18:08
  • @Kusalananda It's just an example, because that struct I was searching for wasn't within any library at all. I edited the struct from __IO to uint64_t so the question makes somehow sense. – Oliver Al-Hassani Jan 15 at 18:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.