Please consider that this intrusive sentence could instead be proclaiming that you help sponsor this research.

Home > Programming > Tools > Visual C++ > Language > Compiler-Generated

Vector Destructor Iterator

The so-called “vector destructor iterator” is known internally by the identifier __vec_dtor (at global scope), with the following compiler-generated code:

inline void __stdcall __vec_dtor (

    void *__t,

    unsigned __s,

    int __n,

    void (__thiscall *__f) (void *))

{

    __t = (char *) __t + __s * __n;

    while (-- __n >= 0) {

        __t = (char *) __t - __s;

        (*__f) (__t);

    }

}

Given __n objects each of size __s in an array at address __t, and a destructor at address __f, the iterator calls the destructor once for each object in the array, in reverse order.

Example

The following fragment induces the compiler to generate a vector constructor iterator:

struct Test

{

    char pad [17];

 

    ~Test (void);

};

 

void test (Test *t)

{

    delete [] t;

}

This page was created on 3rd March 2006. The last significant modification was on 4th March 2006.

Copyright © 2006. Geoff Chappell. All rights reserved.

Please consider that this intrusive sentence could instead be proclaiming that you help sponsor this research.

Home > Programming > Tools > Visual C++ > Language > Compiler-Generated

[Home][Programming Samples][Application Notes][Security Notes][Editorial][Consultation][Contacts]