int main() { int alpha = 7; int beta = 11; aFunc(alpha, beta); return 0; }
void myfun(void) { int sum=0; int *Arr = malloc( 100*sizeof(int) ); puts("enter myfunc()"); for (int i = 0; i < 10; i++) { printf("QQ XD Orz %d\n", i); sum = aFunc(i); } for (int i = 0; i < 10; i++) { short fact =2; for (int j = 0; j < 10; j++) { Arr[i] = i*fact; } } printf(" sum %d\n", sum); puts("leave myfunc()"); }
int CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny* aPtr1, TAny* aPtr2) { TBuf<32> name; TInt status = KErrNone; static TInt ObjectCount = 0; do { name.Format(_L("SDL_%x"), ObjectCount++); status = aFunc(name, aPtr1, aPtr2); } while(status == KErrAlreadyExists); return status; }
int CreateUnique(TInt (*aFunc)(const TDesC& aName, TAny*, TAny*), TAny* aPtr1, TAny* aPtr2) { TBuf<16> name; TInt status = KErrNone; do { object_count++; name.Format(_L("SDL_%x"), object_count); status = aFunc(name, aPtr1, aPtr2); } while(status == KErrAlreadyExists); return status; }
void tst_QGeometryData::copy() { QVector3D a(1.1, 1.2, 1.3); QVector3D b(2.1, 2.2, 2.3); QVector3D c(3.1, 3.2, 3.3); QVector3D d(4.1, 4.2, 4.3); { QGeometryData data; QCOMPARE(data.count(), 0); QCOMPARE(data.fields(), (quint32)0); QGeometryData other; other.appendVertex(QVector3D()); QCOMPARE(other.count(), 1); QCOMPARE(other.fields(), QGL::fieldMask(QGL::Position)); other = aFunc(data); // assignment op - throw away previous d QCOMPARE(other.count(), 1); QCOMPARE(other.fields(), QGL::fieldMask(QGL::Position)); QVector3D res = other.vertices().at(0); QCOMPARE(res, avec); } { QGeometryData data; data.appendVertex(a, b, c, d); QGeometryData other; QCOMPARE(other.count(), 0); QCOMPARE(other.fields(), (quint32)0); other = aFunc(data); // assignment operator other.appendVertex(a); QCOMPARE(other.count(), 6); QCOMPARE(other.fields(), QGL::fieldMask(QGL::Position)); QCOMPARE(other.vertices().count(), 6); QCOMPARE(other.vertices().at(0), a); QCOMPARE(other.vertices().at(1), b); QCOMPARE(other.vertices().at(4), avec); QCOMPARE(other.vertices().at(5), a); } }