1

I've seen two examples of how to define the table name of multi_index:

  • N(tablename)
  • "tablename"_n (source)

Initially I tried using the former, but resulted in the below compilation error. I have since been using the latter without any issue. Are both supported or was this changed in a subsequent release?

error: use of undeclared identifier 'tablename'
        typedef eosio::multi_index<N(tablename), tablerow> tablerow_index;

For reference, I've been using EOSEasyContract for compilation, I'm not sure if this makes any difference. My understanding is it should as it's using a Docker container to run the compilation.

2

The N macro was replaced with the _n operator. It is one of the breaking changes introduced recently. Here is the complete list, https://github.com/EOSIO/eosio.cdt/blob/master/README.md

Removal of the N macro. The ""_n operator or the name constructor should be used as a type safe replacement. Example: N(foo) -> "foo"_n, or N(foo) -> name("foo").

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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