1

When seeing some piece of codes I saw this "declaration" - as far as I can understand this is a declaration - at /drivers/base/cpu.c in the kernel:

static CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);

The file is written in C/C++ is cpu.c but with my limited knowledge of C/C++ I have no idea what the meaning of this "declaration" line. No need to explain about the actual meaning of parameters in this file, if possible just show me the role definition of this "declaration".

14
  • 4
    but with my limited knowledge of C/C++, every person you meet here will have limited to no knowledge of C/C++ because the language doesn't exist. It is either C or C++. Commented Jul 11, 2017 at 4:42
  • 1
    but I guess, @AjayBrahmakshatriya we should start teaching people about c/c++, just to stay away from it, because, it' UB. :) Commented Jul 11, 2017 at 5:27
  • 1
    @SouravGhosh it would be nice to have a book with the title "Guide to using C/C++" and inside it the first page just says - It doesn't exist. End. :) Commented Jul 11, 2017 at 6:05
  • 1
    @AjayBrahmakshatriya - "... it would be nice to have a book ... and inside it the first page just says It doesn't exist" - Unfortunately, it does not exist. In fact, the opposite is true. See the preface of Stroustrup's The C++ Programming Language. Commented Jul 11, 2017 at 6:25
  • 1
    @jww that is all I was saying. The author of the question mentioned - "The file is written in C/C++". I was just pointing out that such a language doesn't exist. I corrected him because he also tagged both the languages. Maybe for this question it doesn't matter because the answer will be the same w.r.t. both the languages but it is bad practice. I am okay with the statement that C is very similar to a subset of C++ (pardon me if my comments gave a hint against it), I was just trying to say that C/C++ doesn't exist. Commented Jul 11, 2017 at 6:38

1 Answer 1

4

Clearly CLASS_ATTR is a macro. These macros is well linked to its definition in the website you post. Just click the name, following the search result, especially in header files you'll find the definition.

CLASS_ATTR

__ATTR

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you so much!
Better to provide definitions in place in answer. Links might gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.