Skip to content

Unnecessary use of extern "C" #3

Description

@martinbudden

RP2040_flash.ini uses

extern "C" {
  #include <hardware/sync.h>
  #include <hardware/flash.h>
};

The SDK (on page 31) states:

The SDK has a C style API, however the SDK headers may be safely included from C++ code, and the functions called
(they are declared with C linkage).

Although it doesn't explicitly say that extern "C" is not required, I've always assumed it meant this and have never used extern "C" when including
the SDK headers. I've also built and run your example without extern "C" and it works fine.

On a separate subject (and perhaps somewhat cheekily) I thought I'd mention that I have written a "flash friendly" library for storing Key-Length-Value
records on flash memory. I think you'd find the implementation interesting, and you may even find it useful in one of your projects. It's at:
https://github.com/martinbudden/Library-FlashKLV

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions