这篇教程C++ typeerror函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中typeerror函数的典型用法代码示例。如果您正苦于以下问题:C++ typeerror函数的具体用法?C++ typeerror怎么用?C++ typeerror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了typeerror函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: subtree/* subtree - construct tree for l - r */static Tree subtree(int op, Tree l, Tree r) { long n; Type ty = inttype; if (isarith(l->type) && isarith(r->type)) { ty = binary(l->type, r->type); l = cast(l, ty); r = cast(r, ty); } else if (isptr(l->type) && !isfunc(l->type->type) && isint(r->type)) { ty = unqual(l->type); n = unqual(ty->type)->size; if (n == 0) error("unknown size for type `%t'/n", ty->type); r = cast(r, promote(r->type)); if (n > 1) r = multree(MUL, cnsttree(signedptr, n), r); if (isunsigned(r->type)) r = cast(r, unsignedptr); else r = cast(r, signedptr); return simplify(SUB+P, ty, l, r); } else if (compatible(l->type, r->type)) { ty = unqual(l->type); n = unqual(ty->type)->size; if (n == 0) error("unknown size for type `%t'/n", ty->type); l = simplify(SUB+U, unsignedptr, cast(l, unsignedptr), cast(r, unsignedptr)); return simplify(DIV+I, longtype, cast(l, longtype), cnsttree(longtype, n)); } else typeerror(op, l, r); return simplify(op, ty, l, r);}
开发者ID:Logout22,项目名称:Escape,代码行数:35,
示例2: addtreestatic Tree addtree(int op, Tree l, Tree r) { Type ty = inttype; if (isarith(l->type) && isarith(r->type)) { ty = binary(l->type, r->type); l = cast(l, ty); r = cast(r, ty); } else if (isptr(l->type) && isint(r->type)) return addtree(ADD, r, l); else if ( isptr(r->type) && isint(l->type) && !isfunc(r->type->type)) { long n; ty = unqual(r->type); n = unqual(ty->type)->size; if (n == 0) error("unknown size for type `%t'/n", ty->type); l = cast(l, promote(l->type)); if (n > 1) l = multree(MUL, cnsttree(signedptr, n), l); if (isunsigned(l->type)) l = cast(l, unsignedptr); else l = cast(l, signedptr); if (YYcheck && !isaddrop(r->op)) /* omit */ return nullcall(ty, YYcheck, r, l); /* omit */ return simplify(ADD, ty, l, r); } else typeerror(op, l, r); return simplify(op, ty, l, r);}
开发者ID:Logout22,项目名称:Escape,代码行数:33,
示例3: test void test() { int a, b; auto a1 = [a]() {}; auto b1 = [b]() {}; //printf("%s == $s/n", typeid(a).name(), typeid(b).name()); typeerror( a1, b1 ); //typeerror( std::is_same<decltype(a1),decltype(2)>::value ); }
开发者ID:alexpolt,项目名称:trash,代码行数:9,
示例4: multree/* multree - construct tree for l [* /] r */static Tree multree(int op, Tree l, Tree r) { Type ty = inttype; if (isarith(l->type) && isarith(r->type)) { ty = binary(l->type, r->type); l = cast(l, ty); r = cast(r, ty); } else typeerror(op, l, r); return simplify(op, ty, l, r);}
开发者ID:haplesshero13,项目名称:lcc-lc3,代码行数:12,
示例5: shtree/* shtree - construct tree for l [>> <<] r */Tree shtree(int op, Tree l, Tree r) { Type ty = inttype; if (isint(l->type) && isint(r->type)) { ty = promote(l->type); l = cast(l, ty); r = cast(r, inttype); } else typeerror(op, l, r); return simplify(op, ty, l, r);}
开发者ID:haplesshero13,项目名称:lcc-lc3,代码行数:12,
示例6: condtreeTree condtree(Tree e, Tree l, Tree r) { Symbol t1; Type ty, xty = l->type, yty = r->type; Tree p; if (isarith(xty) && isarith(yty)) ty = binary(xty, yty); else if (eqtype(xty, yty, 1)) ty = unqual(xty); else if (isptr(xty) && isnullptr(r)) ty = xty; else if (isnullptr(l) && isptr(yty)) ty = yty; else if (isptr(xty) && !isfunc(xty->type) && isvoidptr(yty) || isptr(yty) && !isfunc(yty->type) && isvoidptr(xty)) ty = voidptype; else if ((isptr(xty) && isptr(yty) && eqtype(unqual(xty->type), unqual(yty->type), 1))) ty = xty; else { typeerror(COND, l, r); return consttree(0, inttype); } if (isptr(ty)) { ty = unqual(unqual(ty)->type); if (isptr(xty) && isconst(unqual(xty)->type) || isptr(yty) && isconst(unqual(yty)->type)) ty = qual(CONST, ty); if (isptr(xty) && isvolatile(unqual(xty)->type) || isptr(yty) && isvolatile(unqual(yty)->type)) ty = qual(VOLATILE, ty); ty = ptr(ty); } switch (e->op) { case CNST+I: return cast(e->u.v.i != 0 ? l : r, ty); case CNST+U: return cast(e->u.v.u != 0 ? l : r, ty); case CNST+P: return cast(e->u.v.p != 0 ? l : r, ty); case CNST+F: return cast(e->u.v.d != 0.0 ? l : r, ty); } if (ty != voidtype && ty->size > 0) { t1 = genident(REGISTER, unqual(ty), level); /* t1 = temporary(REGISTER, unqual(ty)); */ l = asgn(t1, l); r = asgn(t1, r); } else t1 = NULL; p = tree(COND, ty, cond(e), tree(RIGHT, ty, root(l), root(r))); p->u.sym = t1; return p;}
开发者ID:haplesshero13,项目名称:lcc-lc3,代码行数:51,
示例7: r_gmprandstate_rrandomb/* * call-seq: * rand_state.rrandomb(fixnum) * * From the GMP Manual: * * Generate a random integer with long strings of zeros and ones in the binary * representation. Useful for testing functions and algorithms, since this kind * of random numbers have proven to be more likely to trigger corner-case bugs. * The random number will be in the range 0 to 2^n-1, inclusive. */VALUE r_gmprandstate_rrandomb(VALUE self, VALUE arg){ MP_RANDSTATE *self_val; MP_INT *res_val; VALUE res; mprandstate_get_struct(self,self_val); if (FIXNUM_P(arg)) { mpz_make_struct_init(res, res_val); mpz_rrandomb(res_val, self_val, FIX2INT(arg)); } else { typeerror(X); } return res;}
开发者ID:sagmor,项目名称:gmp,代码行数:28,
示例8: cmptreestatic Tree cmptree(int op, Tree l, Tree r) { Type ty; if (isarith(l->type) && isarith(r->type)) { ty = binary(l->type, r->type); l = cast(l, ty); r = cast(r, ty); } else if (compatible(l->type, r->type)) { ty = unsignedptr; l = cast(l, ty); r = cast(r, ty); } else { ty = unsignedtype; typeerror(op, l, r); } return simplify(mkop(op,ty), inttype, l, r);}
开发者ID:haplesshero13,项目名称:lcc-lc3,代码行数:17,
示例9: r_gmprandstate_seed/* * call-seq: * rand_state.seed(integer) * * From the GMP Manual: * * Set an initial seed value into state. * * The size of a seed determines how many different sequences of random numbers * that it's possible to generate. The “quality” of the seed is the randomness * of a given seed compared to the previous seed used, and this affects the * randomness of separate number sequences. The method for choosing a seed is * critical if the generated numbers are to be used for important applications, * such as generating cryptographic keys. * * Traditionally the system time has been used to seed, but care needs to be * taken with this. If an application seeds often and the resolution of the * system clock is low, then the same sequence of numbers might be repeated. * Also, the system time is quite easy to guess, so if unpredictability is * required then it should definitely not be the only source for the seed * value. On some systems there's a special device /dev/random which provides * random data better suited for use as a seed. */VALUE r_gmprandstate_seed(VALUE self, VALUE arg){ MP_RANDSTATE *self_val; MP_INT *arg_val; mprandstate_get_struct(self,self_val); if (GMPZ_P(arg)) { mpz_get_struct(arg,arg_val); gmp_randseed(self_val, arg_val); } else if (FIXNUM_P(arg)) { gmp_randseed_ui(self_val, FIX2INT(arg)); } else if (BIGNUM_P(arg)) { mpz_temp_from_bignum(arg_val, arg); gmp_randseed(self_val, arg_val); } else { typeerror(ZXB); } return arg;}
开发者ID:sagmor,项目名称:gmp,代码行数:43,
示例10: tag_errorstatic void tag_error (lua_State *L, int narg, int tag) { typeerror(L, narg, lua_typename(L, tag));}
开发者ID:dhrebeniuk,项目名称:linosity,代码行数:3,
示例11: luaL_testudataLUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { void *p = luaL_testudata(L, ud, tname); if (p == NULL) typeerror(L, ud, tname); return p;}
开发者ID:dhrebeniuk,项目名称:linosity,代码行数:5,
示例12: unaryTree unary(void) { Tree p; switch (t) { case '*': t = gettok(); p = unary(); p = pointer(p); if (isptr(p->type) && (isfunc(p->type->type) || isarray(p->type->type))) p = retype(p, p->type->type); else { if (YYnull) p = nullcheck(p); p = rvalue(p); } break; case '&': t = gettok(); p = unary(); if (isarray(p->type) || isfunc(p->type)) p = retype(p, ptr(p->type)); else p = lvalue(p); if (isaddrop(p->op) && p->u.sym->sclass == REGISTER) error("invalid operand of unary &; `%s' is declared register/n", p->u.sym->name); else if (isaddrop(p->op)) p->u.sym->addressed = 1; break; case '+': t = gettok(); p = unary(); p = pointer(p); if (isarith(p->type)) p = cast(p, promote(p->type)); else typeerror(ADD, p, NULL); break; case '-': t = gettok(); p = unary(); p = pointer(p); if (isarith(p->type)) { Type ty = promote(p->type); p = cast(p, ty); if (isunsigned(ty)) { warning("unsigned operand of unary -/n"); p = simplify(ADD, ty, simplify(BCOM, ty, p, NULL), cnsttree(ty, 1UL)); } else p = simplify(NEG, ty, p, NULL); } else typeerror(SUB, p, NULL); break; case '~': t = gettok(); p = unary(); p = pointer(p); if (isint(p->type)) { Type ty = promote(p->type); p = simplify(BCOM, ty, cast(p, ty), NULL); } else typeerror(BCOM, p, NULL); break; case '!': t = gettok(); p = unary(); p = pointer(p); if (isscalar(p->type)) p = simplify(NOT, inttype, cond(p), NULL); else typeerror(NOT, p, NULL); break; case INCR: t = gettok(); p = unary(); p = incr(INCR, pointer(p), consttree(1, inttype)); break; case DECR: t = gettok(); p = unary(); p = incr(DECR, pointer(p), consttree(1, inttype)); break; case TYPECODE: case SIZEOF: { int op = t; Type ty; p = NULL; t = gettok(); if (t == '(') { t = gettok(); if (istypename(t, tsym)) { ty = typename(); expect(')'); } else { p = postfix(expr(')')); ty = p->type; } } else {
开发者ID:DCPUTools,项目名称:dcpu16-lcc,代码行数:66,
示例13: luaL_typerrorLUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { return typeerror(L, narg, tname);}
开发者ID:ehsan,项目名称:wesnoth,代码行数:3,
示例14: tag_errorstatic void tag_error (LuaThread *L, int narg, int tag) { THREAD_CHECK(L); typeerror(L, narg, lua_typename(L, tag));}
开发者ID:aappleby,项目名称:Lumina,代码行数:4,
示例15: THREAD_CHECKvoid *luaL_checkudata (LuaThread *L, int ud, const char *tname) { THREAD_CHECK(L); void *p = luaL_testudata(L, ud, tname); if (p == NULL) typeerror(L, ud, tname); return p;}
开发者ID:aappleby,项目名称:Lumina,代码行数:6,
示例16: andtree/* andtree - construct tree for l [&& ||] r */static Tree andtree(int op, Tree l, Tree r) { if (!isscalar(l->type) || !isscalar(r->type)) typeerror(op, l, r); return simplify(op, inttype, cond(l), cond(r));}
开发者ID:haplesshero13,项目名称:lcc-lc3,代码行数:6,
注:本文中的typeerror函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ typelib_static_mi_interface_type_init函数代码示例 C++ type_size函数代码示例 |