From 455fbac64f101b05f7eaca89b84470569e4df3fd Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 19 Jan 2016 23:18:03 -0800 Subject: 2576 - distinguish allocated addresses from others This is the one major refinement on the C programming model I'm planning to introduce in mu. Instead of Rust's menagerie of pointer types and static checking, I want to introduce just one new type, and use it to perform ref-counting at runtime. So far all we're doing is updating new's interface. The actual ref-counting implementation is next. One implication: I might sometimes need duplicate implementations for a recipe with allocated vs vanilla addresses of the same type. So far it seems I can get away with just always passing in allocated addresses; the situations when you want to pass an unallocated address to a recipe should be few and far between. --- 042name.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '042name.cc') diff --git a/042name.cc b/042name.cc index 7ad45b89..4c855570 100644 --- a/042name.cc +++ b/042name.cc @@ -92,8 +92,10 @@ long long int lookup_name(const reagent& r, const recipe_ordinal default_recipe) } type_ordinal skip_addresses(type_tree* type, const string& recipe_name) { + type_ordinal address = get(Type_ordinal, "address"); + type_ordinal shared = get(Type_ordinal, "shared"); for (; type; type = type->right) { - if (type->value != get(Type_ordinal, "address")) + if (type->value != address && type->value != shared) return type->value; } raise_error << maybe(recipe_name) << "expected a container" << '\n' << end(); -- cgit 1.4.1-2-gfad0