[erlang-questions] Encoding empty strings using ei

Peter Membrey peter@REDACTED
Wed Jul 31 17:57:15 CEST 2013


Hi guys,

I've got a C program that encodes a list of tuples to send to an Erlang 
server, something like this:

{mylist, [{1,2,3} , {2,3,4} , {3,4,5}]}

To do this I encode a list header with:

ei_x_encode_list_header(ei_x_buff* x, int arity);

and all is well.

The question I have though, is what should I do if I encode this tuple?

{mylist, [] }

Should I encode the tuple, followed by an empty list 
(ei_x_encode_empty_list) or do I need to put in a list header with an 
arity of 0 and then add the empty list?

In short, what is the correct way to encode an empty list using the ei 
interface.

Thanks in advance!

Cheers,

Pete



More information about the erlang-questions mailing list