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


C++ Foo::setA方法代码示例

本文整理汇总了C++中Foo::setA方法的典型用法代码示例。如果您正苦于以下问题:C++ Foo::setA方法的具体用法?C++ Foo::setA怎么用?C++ Foo::setA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Foo的用法示例。


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

示例1: func

int func()
{
  Bar *bar1, bar2;
  Foo local_foo;
  int x = x; // { dg-warning "assigned to itself" }
  static int y = y; // { dg-warning "assigned to itself" }
  float *f;
  Bar bar_array[5];
  char n;
  int overflow;

  *f = *f; // { dg-warning "assigned to itself" }
  bar1->b_ = bar1->b_; // { dg-warning "assigned to itself" }
  bar2.c_ = bar2.c_; // { dg-warning "assigned to itself" }
  local_foo = local_foo;
  foo = foo;
  foo.setA(5);
  bar_array[3].c_ = bar_array[3].c_; // { dg-warning "assigned to itself" }
  bar_array[x+g].b_ = bar_array[x+g].b_; // { dg-warning "assigned to itself" }
  y = x;
  x = y;
  x += 0; // should not warn
  y -= 0; // should not warn
  x /= x; // should not warn
  y *= y; // should not warn
}
开发者ID:ds2dev,项目名称:gcc,代码行数:26,代码来源:Wself-assign-1.C

示例2: func

int func()
{
  Bar *bar1, bar2;
  Foo foo;
  int x = x - 0;        // should not warn
  static int y = y / 1; // should not warn
  float *f;
  Bar bar_array[5];

  *f = *f / 1;             // should not warn
  bar1->b_ = bar1->b_ * 1; // should not warn
  bar2.c_ = bar2.c_ - 0;   // should not warn
  foo.setA(5);
  bar_array[3].c_ = bar_array[3].c_ * 1;     // should not warn
  bar_array[x+g].b_ = bar_array[x+g].b_ / 1; // should not warn
  x += 0;
  y -= 0;
  foo = foo;
  foo.operator=(foo);  // should not warn
}
开发者ID:ds2dev,项目名称:gcc,代码行数:20,代码来源:Wself-assign-4.C

示例3: func

int func()
{
  Bar *bar1, bar2;
  Foo local_foo;
  int x = x; // { dg-bogus "assigned to itself" }
  static int y = y; // { dg-bogus "assigned to itself" }
  float *f;
  Bar bar_array[5];
  char n;
  int overflow;

  *f = *f; // { dg-bogus "assigned to itself" }
  bar1->b_ = bar1->b_; // { dg-bogus "assigned to itself" }
  bar2.c_ = bar2.c_; // { dg-bogus "assigned to itself" }
  local_foo = local_foo; // { dg-bogus "assigned to itself" }
  foo = foo; // { dg-bogus "assigned to itself" }
  foo.setA(5);
  bar_array[3].c_ = bar_array[3].c_; // { dg-bogus "assigned to itself" }
  bar_array[x+g].b_ = bar_array[x+g].b_; // { dg-bogus "self-assignment detected" }
  y = x;
  x = y;
}
开发者ID:sylvestre,项目名称:gcc,代码行数:22,代码来源:self-assign-test-3.C


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