-->
Page 1 of 1

Using namespaces in Sming framework

PostPosted: Thu May 12, 2016 7:21 pm
by Cap
Any considerations that went into deciding for/against using namespaces in Sming framework? Any thoughts in adding namespace to the SmingCore and other subsystems in the future?

Re: Using namespaces in Sming framework

PostPosted: Sat May 14, 2016 7:30 am
by zhivko
Yes since I would like to use code from another opensource project, I do not see any other option than using namespace to prevent symbol overlaping.

I try to use google protobuf in SmingRTOS and for example
in file: google/protobuf/message.h
where source is:
Code: Select alltemplate<typename PB>
inline const RepeatedPtrField<PB>& Reflection::GetRepeatedPtrField(
    const Message& message, const FieldDescriptor* field) const {
  return *static_cast<RepeatedPtrField<PB>* >(
      MutableRawRepeatedField(const_cast<Message*>(&message), field,
          FieldDescriptor::CPPTYPE_MESSAGE, -1,
          PB::default_instance().GetDescriptor()));
}


I get:
Description Resource Path Location Type
expected a type, got '2' message.h /RTOS-Stepper-DM542/app/google/protobuf line 846 C/C++ Problem

thats because PB is defined in SmintRTOS file pins_arduino.h like:
Code: Select all#define PB 2