gcc vs clang

31 views
Skip to first unread message

Puneet M

unread,
Feb 16, 2022, 9:21:56 AM2/16/22
to wiredtiger-users

Hello,

I have a table (adjlist) of the form: id, num-links, {links}.

Here id and num-links are int64 (I) and links is an array of ints that I am storing as a raw array (u).  Key format is I(id), and the value format is Iu (num-links, links).

Links can be empty, and therefore I had this logic in my code for creating an empty array:

Screen Shot 2022-02-16 at 19.46.42.png

When I compile this with clang (Ubuntu clang version 13.0.0-2), this works just fine. However, when I use GCC (v9.3.0), I run into the following error:

Screen Shot 2022-02-16 at 19.49.14.png

Is there something fundamentally wrong that I am doing, or have I run into a strange compiler issue? What is the recommended way to store an empty WT_ITEM?

thanks,
-puneet

alexande...@mongodb.com

unread,
Feb 16, 2022, 9:30:10 PM2/16/22
to wiredtiger-users
Hi Puneet,

Thanks for using WiredTiger and for reaching out!

I *think* you should be passing the WT_ITEM structure to the WT_CURSOR::set_value call by reference instead of directly. So:

cursor->set_value(cursor, 0, &item);
instead of:
cursor->set_value(cursor, 0, item);

- Alex

Alexey Anisimov

unread,
Mar 8, 2022, 3:32:05 AM3/8/22
to wiredtig...@googlegroups.com
Hi Puneet,

Thanks for your interest in WiredTiger! In your example, "cursor->set_value" expects a pointer as the third argument. Please refer to this example.
Please let me know if the suggested solution works for you.

Regards,
Alexey

--
You received this message because you are subscribed to the Google Groups "wiredtiger-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wiredtiger-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wiredtiger-users/f3de51fa-2414-47d7-ae3b-24570fff7cban%40googlegroups.com.


--

{ name     : "Alexey Anisimov",
  title    : "Senior Software Engineer",
  location : "Sydney, Australia" }

Reply all
Reply to author
Forward
0 new messages