当前位置: 首页>>代码示例>>C++>>正文


C++ dereference函数代码示例

本文整理汇总了C++中dereference函数的典型用法代码示例。如果您正苦于以下问题:C++ dereference函数的具体用法?C++ dereference怎么用?C++ dereference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dereference函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: clReleaseMemObject

cl_int
clReleaseMemObject(cl_mem d_memobj)
{
    auto memobj = pobj(d_memobj);

    if (!memobj->isA(Coal::Object::T_MemObject))
        return CL_INVALID_MEM_OBJECT;

    if (memobj->dereference())
        delete memobj;

    return CL_SUCCESS;
}
开发者ID:rcn-ee,项目名称:ti-opencl,代码行数:13,代码来源:api_memory.cpp

示例2: clReleaseDevice

cl_int
clReleaseDevice(cl_device_id d_device)
{
    auto device = pobj(d_device);

    if (!device->isA(Coal::Object::T_Device))
        return CL_INVALID_DEVICE;

    if (device->dereference())
        delete device;

    return CL_SUCCESS;
}
开发者ID:yukke-fj,项目名称:shamrock,代码行数:13,代码来源:api_device.cpp

示例3: clReleaseSampler

cl_int
clReleaseSampler(cl_sampler d_sampler)
{
    auto sampler = pobj(d_sampler);

    if (!sampler->isA(Coal::Object::T_Sampler))
        return CL_INVALID_SAMPLER;

    if (sampler->dereference())
        delete sampler;

    return CL_SUCCESS;
}
开发者ID:rcn-ee,项目名称:ti-opencl,代码行数:13,代码来源:api_sampler.cpp

示例4: assert

void preconditiont::compute_rec(exprt &dest)
{
  if(dest.id()==ID_address_of)
  {
    // only do index!
    assert(dest.operands().size()==1);
    compute_address_of(dest.op0());
  }
  else if(dest.id()==ID_dereference)
  {
    assert(dest.operands().size()==1);

    const irep_idt &lhs_identifier=SSA_step.ssa_lhs.get_object_name();

    // aliasing may happen here

    value_setst::valuest expr_set;
    value_sets.get_values(target, dest.op0(), expr_set);
    std::unordered_set<irep_idt, irep_id_hash> symbols;

    for(value_setst::valuest::const_iterator
        it=expr_set.begin();
        it!=expr_set.end();
        it++)
      find_symbols(*it, symbols);

    if(symbols.find(lhs_identifier)!=symbols.end())
    {
      // may alias!
      exprt tmp;
      tmp.swap(dest.op0());
      dereference(target, tmp, ns, value_sets);
      dest.swap(tmp);
      compute_rec(dest);
    }
    else
    {
      // nah, ok
      compute_rec(dest.op0());
    }
  }
  else if(dest==SSA_step.ssa_lhs.get_original_expr())
  {
    dest=SSA_step.ssa_rhs;
    s.get_original_name(dest);
  }
  else
    Forall_operands(it, dest)
      compute_rec(*it);
}
开发者ID:DanielNeville,项目名称:cbmc,代码行数:50,代码来源:precondition.cpp

示例5: unifyTVarR

ExprType* unifyTVarR(ExprType *type, ExprType* expected, Hashtable *varTypes, Region *r) {
    char buf[128];
    if(T_VAR_NUM_DISJUNCTS(expected)==0) { /* free */
    	if(occursIn(expected, type)) {
    		return NULL;
    	}
        insertIntoHashTable(varTypes, getTVarName(T_VAR_ID(expected), buf), type);
        return dereference(expected, varTypes, r);
    } else { /* union type */
        int i;
        ExprType *ty = NULL;
        for(i=0;i<T_VAR_NUM_DISJUNCTS(expected);i++) {
            if(getNodeType(type) == getNodeType(T_VAR_DISJUNCT(expected,i))) { /* union types can only include primitive types */
                ty = type;
            }
        }
        if(ty != NULL) {
            insertIntoHashTable(varTypes, getTVarName(T_VAR_ID(expected), buf), ty);
            return dereference(expected, varTypes, r);
        }
        return ty;
    }

}
开发者ID:UPPMAX,项目名称:irods,代码行数:24,代码来源:utils.c

示例6: clReleaseCommandQueue

cl_int
clReleaseCommandQueue(cl_command_queue d_command_queue)
{
    auto command_queue = pobj(d_command_queue);

    if (!command_queue->isA(Coal::Object::T_CommandQueue))
        return CL_INVALID_COMMAND_QUEUE;

    command_queue->flush();

    if (command_queue->dereference())
        delete command_queue;

    return CL_SUCCESS;
}
开发者ID:rcn-ee,项目名称:ti-opencl,代码行数:15,代码来源:api_command.cpp

示例7: subscript

static
subscript(stream, node, need_lval) {
    auto type = node[3][2];  /* type being subscripted */

    /* For (hopefully temporary) compatibility with stage-4, we allow an 
     * implicit int to be dereferenced as an int*. */
    extern compat_flag;
    auto elt_sz = compat_flag && type == implct_int() ? 4 
        : type_size( type[3] );        /* remove * or [] from type */

    auto sz = type_size( node[2] );

    scale_elt(stream, elt_sz, 1);
    pop_add(stream, 0, 4);
    dereference(stream, sz, need_lval);
}
开发者ID:ras52,项目名称:bootstrap,代码行数:16,代码来源:codegen.c

示例8: dereference

void Designator::add_key(const std::string& key_param,
      const Location& loc) {
   dereference(loc);
   if (!at) {
      throw Exception(loc, "null cannot be used as dictionary");
   }
   if (at->get_type() == Attribute::tree) {
      at = at->get_node()->get_attribute();
   } else if (at->get_type() == Attribute::flow_graph_node) {
      at = at->get_fgnode()->get_attribute();
   }
   if (at->get_type() != Attribute::dictionary) {
      throw Exception(loc, "is not a dictionary");
   }
   key = key_param; lvalue = true;
}
开发者ID:afborchert,项目名称:astl,代码行数:16,代码来源:designator.cpp

示例9: name

symbol * name(int dcl)
{
  symbol * q = NULL;
  if(sym_exists(token) || dcl)
  {
    int c = 0;
    int v = 0;
    int l = 0;
    l = caddr(sym_addr(token, &c, &v, &q));
    scan();
    g_mov_bx(l);
    g_push_bx();
    dereference();
  } else
  {
    error("Expected identifier");
  }
  return q;
}
开发者ID:catseye,项目名称:Illgol-Grand-Mal,代码行数:19,代码来源:parse.c

示例10: binary_op

static
binary_op(stream, node, need_lval) {
    auto op = node[0], sz = type_size( node[2] );

    expr_code( stream, node[3], is_assop(op) );
    asm_push( stream );
    expr_code( stream, node[4], 0 );

    if      ( op == '[]'  ) subscript(stream, node, need_lval);
    else if ( op == '*'   ) pop_mult(stream, 0, node[2][5]);
    else if ( op == '/'   ) pop_div(stream, 0, node[2][5]);
    else if ( op == '%'   ) pop_mod(stream, 0, node[2][5]);
    else if ( op == '+'   ) add_op(stream, node, 0, sz);
    else if ( op == '-'   ) add_op(stream, node, 0, sz);
    else if ( op == '<<'  ) pop_lshift(stream, 0);
    else if ( op == '>>'  ) pop_rshift(stream, 0);
    else if ( op == '&'   ) pop_bitand(stream, 0, sz);
    else if ( op == '|'   ) pop_bitor(stream, 0, sz);
    else if ( op == '^'   ) pop_bitxor(stream, 0, sz);

    else if ( op == '='   ) pop_assign(stream, sz);
    else if ( op == '*='  ) pop_mult(stream, 1);
    else if ( op == '/='  ) pop_div(stream, 1);
    else if ( op == '%='  ) pop_mod(stream, 1);
    else if ( op == '+='  ) add_op(stream, node, 1, sz);
    else if ( op == '-='  ) add_op(stream, node, 1, sz);
    else if ( op == '<<=' ) pop_lshift(stream, 1);
    else if ( op == '>>=' ) pop_rshift(stream, 1);
    else if ( op == '&='  ) pop_bitand(stream, 1, sz);
    else if ( op == '|='  ) pop_bitor(stream, 1, sz);
    else if ( op == '^='  ) pop_bitxor(stream, 1, sz);

    else int_error("Unknown operator: '%Mc'", op);

    /* The assignment operators are implemented to return lvalues, but
     * the C standard says they're not lvalues.  (The C++ standard has
     * them as lvalues.)  */
    if ( is_assop(op) )
        dereference(stream, type_size(node[2]), 0);
}
开发者ID:ras52,项目名称:bootstrap,代码行数:40,代码来源:codegen.c

示例11: second_chance_select

/**
 * Second chance select implementation for choosing pages to
 * swap out. This will loop through the queue and find the
 * oldest unreferenced page.
 * Note: Since we use software emulated reference bits, in case
 * everything is mapped in the HW page table this degenerates
 * to pure FIFO.
 *
 * @param page_queue
 * @return oldest unreferenced page (removed from the queue)
 */
static page_queue_item* second_chance_select(struct pages_head* page_queue) {

	page_queue_item* page;

	// do a second chance search for a page over all currently active pages
    for(page = page_queue->tqh_first; page != NULL; page = page_queue->tqh_first) {

    	if(is_referenced(page)) {
    		TAILQ_REMOVE(page_queue, page, entries); // remove oldest page
    		dereference(page);
    		TAILQ_INSERT_TAIL(page_queue, page, entries); // insert at front
    	}
    	else {
    		// remove the page from the working set
    		TAILQ_REMOVE(page_queue, page, entries);
    		return page;
    	}

    }

    return NULL; // no pages in queue (bad)
}
开发者ID:gz,项目名称:aos10,代码行数:33,代码来源:swapper.c

示例12: read_lhs

exprt local_SSAt::read_lhs(
  const exprt &expr,
  locationt loc) const
{
  // dereference first
  exprt tmp1=dereference(expr, loc);

  ssa_objectt object(tmp1, ns);

  // is this an object we track?
  if(ssa_objects.objects.find(object)!=
     ssa_objects.objects.end())
  {
    // yes, it is
    if(assignments.assigns(loc, object))
      return name(object, OUT, loc);
    else
      return read_rhs(object, loc);
  }
  else
    return read_rhs(tmp1, loc);
}
开发者ID:AnnaTrost,项目名称:deltacheck,代码行数:22,代码来源:local_ssa.cpp

示例13: leftSymbolName

VisitResult ExpressionVisitor::Visit(IndexNode* node)
{
  node->Walk(this, false);
  ValueNode* leftSide = static_cast<ValueNode*>(node->mLeft.get());
  ValueNode* indexExpr = static_cast<ValueNode*>(node->mIndex.get());
  std::string leftSymbolName(leftSide->mToken.mText, leftSide->mToken.mLength);
  std::string indexSymbolName(indexExpr->mToken.mText, indexExpr->mToken.mLength);
  if(leftSide->mResolvedType->mMode == TypeMode::Pointer)
  {
    node->mResolvedType = dereference(leftSide->mResolvedType);
  }
  else
  {
    ErrorInvalidIndexer(node);
  }
  if(indexExpr->mResolvedType->mName != "Integer")
  {
    ErrorInvalidIndexer(node);
  }

  return VisitResult::Stop;

}
开发者ID:Marktopus,项目名称:SchoolRepo,代码行数:23,代码来源:User4.cpp

示例14: unary_pre

static
unary_pre(stream, node, need_lval) {
    auto op = node[0];
    auto op_needs_lv = op == '++' || op == '--' || op == '&';
    auto sz = type_size(node[2]);
    expr_code( stream, node[3], op_needs_lv );

    if ( op == '+'  ) {
        /* Arrays degrade to pointers. */
        auto src_sz;
        if ( node[3][2][0] == '[]' ) src_sz = 4;
        else src_sz = type_size(node[3][2]);
        promote(stream, node[2][5], src_sz, sz);
    }
    else if ( op == '-'  ) arith_neg(stream);
    else if ( op == '~'  ) bit_not(stream);
    else if ( op == '!'  ) logic_not(stream);
    else if ( op == '&'  ) ;
    else if ( op == '*'  ) dereference(stream, sz, need_lval);
    else if ( op == '++' ) increment(stream, sz,  ptr_inc_sz(node[2]) );
    else if ( op == '--' ) increment(stream, sz, -ptr_inc_sz(node[2]) );
    else int_error("Unknown operator: '%Mc'", op);
}
开发者ID:ras52,项目名称:bootstrap,代码行数:23,代码来源:codegen.c

示例15: if

void Serializer::serialize(Any object, ITypeMeta* type)
{
    auto flags = type->getFlags();
    if (flags & ITypeMeta::IsCustomSerializing)
    {
        auto classMeta = static_cast<IClassMeta*>(type);
        classMeta->functions["serialize"]->invoke(object, this);
    }
    else if (flags & ITypeMeta::IsPointer)
    {
        lua_newtable(L);
        lua_pushinteger(L, 1);

        auto pointeeType = type->getRunTimePointeeType(object);
        object = pointeeType->dereference(object);
        serialize(object, pointeeType);

        lua_settable(L, -3);
    }
    else if (type == typeMetaOf<std::string>())
    {
        lua_pushstring(L, object.as<std::string>().c_str());
    }
    else if (flags & ITypeMeta::IsClass)
    {
        auto classMeta = static_cast<IClassMeta*>(type);
        serializeAsClass(object, classMeta);
    }
    else if (type == typeMetaOf<int>())
    {
        lua_pushinteger(L, object.as<int>());
    }
    else if (type == typeMetaOf<float>())
    {
        lua_pushnumber(L, object.as<float>());
    }
}
开发者ID:Alprog,项目名称:Judy,代码行数:37,代码来源:Serializer.cpp


注:本文中的dereference函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。