Hi I'm working on some impact analysis stuff for C++. I was wondering if
anyone has seen an example of a type (lets say type "A") change impacting
the storage/layout another type (lets say type "B"), but B does not include
the header/src file where A is defined.
Also B is using type A by more than just a pointer, that is B needs to know
the size/layout of A.
For most (all?) complex types, I presume that the compiler must see the full
declaration of the type its using, in order to know the size, alignment,
layout etc. Is there any sneaky way around this, that I might have to
account for when trying to find the impact of a changed type?
Another way to ask this question; if I know exactly which header file type A
is defined in, and I know that type A has changed in size/layout, can I
assume that only the files which include type A's header are candidate
users? ...the places where some other type might possibly use type A
It sounds like a reasonable assumption, but there are lots of sneaky things
that can be done in C++. :( Maybe there is a way around this assumption?
Thanks in advance for any tips or examples that you've encountered...
(^_^)/
mike. mg*****@nortelnetworks.com 3 1213
On Mon, 18 Oct 2004 15:55:50 -0400, "Garvin, Michael [CAR:C28G:EXCH]"
<mg*****@americasm01.nt.com> wrote: Hi I'm working on some impact analysis stuff for C++. I was wondering if anyone has seen an example of a type (lets say type "A") change impacting the storage/layout another type (lets say type "B"), but B does not include the header/src file where A is defined. Also B is using type A by more than just a pointer, that is B needs to know the size/layout of A.
For most (all?) complex types, I presume that the compiler must see the full declaration of the type its using, in order to know the size, alignment, layout etc. Is there any sneaky way around this, that I might have to account for when trying to find the impact of a changed type?
Another way to ask this question; if I know exactly which header file type A is defined in, and I know that type A has changed in size/layout, can I assume that only the files which include type A's header are candidate users? ...the places where some other type might possibly use type A
It's a good starting point.
It sounds like a reasonable assumption, but there are lots of sneaky things that can be done in C++. :( Maybe there is a way around this assumption?
If inclusion of headers is "well-behaved", i.e. you don't change
alignment or struct packing somewhere with #pragma's before including
it, this should be sufficient.
Thanks in advance for any tips or examples that you've encountered...
(^_^)/ mike.
mg*****@nortelnetworks.com
--
Bob Hairgrove No**********@Home.com
Cool, thanks for the tip!
I've been hunting through the literature on impact analysis. The research
seems to be more abstract though, at a level where they assume you have the
abstract grammar graph for the entire system. Such analysis is valuable,
but unfortunately, I have to work on things incrementally. The bodies of
code I work on have 10s of millions of lines code :( I simply can't
construct the whole graph at once, I have to walk from a given starting
(changed!) type outwards. Hence my focus on trying to narrow down the
candidate places to look for impacts :)
Thanks again for the info,
(^_^)/
mike.
"Bob Hairgrove" <in*****@bigfoot.com> wrote in message
news:2u********************************@4ax.com... On Mon, 18 Oct 2004 15:55:50 -0400, "Garvin, Michael [CAR:C28G:EXCH]" <mg*****@americasm01.nt.com> wrote:
Hi I'm working on some impact analysis stuff for C++. I was wondering if anyone has seen an example of a type (lets say type "A") change impacting the storage/layout another type (lets say type "B"), but B does not
includethe header/src file where A is defined. Also B is using type A by more than just a pointer, that is B needs to
knowthe size/layout of A.
For most (all?) complex types, I presume that the compiler must see the
fulldeclaration of the type its using, in order to know the size, alignment, layout etc. Is there any sneaky way around this, that I might have to account for when trying to find the impact of a changed type?
Another way to ask this question; if I know exactly which header file
type Ais defined in, and I know that type A has changed in size/layout, can I assume that only the files which include type A's header are candidate users? ...the places where some other type might possibly use type A It's a good starting point.
It sounds like a reasonable assumption, but there are lots of sneaky
thingsthat can be done in C++. :( Maybe there is a way around this
assumption? If inclusion of headers is "well-behaved", i.e. you don't change alignment or struct packing somewhere with #pragma's before including it, this should be sufficient.
Thanks in advance for any tips or examples that you've encountered...
(^_^)/ mike.
mg*****@nortelnetworks.com
-- Bob Hairgrove No**********@Home.com
Hey, found some "incomplete" type examples on the net, they seem to back up
the assumption that the compiler has to see the type, where it actually
tries to use it.
Example 1:
class E;
template <int> struct Z1 {
E e;
};
int main(int argc, char **argv) {
//struct Z1 a;
}
The compiler (at least gcc 2.95.x) fails out if you uncomment out the line
in main(). If 'E' was defined in header "A.h", then A.h would have to have
been included for it to work.
Example 2:
#include <list>
class TermArg;
class Term {
std::list<TermArg> args_;
};
int main(int argc, char **argv) {
//Term t;
return 0;
}
Again, the copmiler (gcc 2.95.x) allows the incomplete type to be used,
until the point where you actually try to use it.
Example 3:
class T;
T* CreateT();
int main() {
//delete CreateT();
}
Again the compiler (gcc 2.95.x) allows the incomplete type to be used. It
seems at least for the compiler I'm using, that types have to be complete,
or the compiler will bail. Since I'm working on code that I know has
already compiled, I think my assumption about type users including the type
definining header is pretty safe.
However, I wonder if other compilers, or even other versions of gcc will let
incomplete types through? I guess I'll have to search through the C++
standard specification (if I can find it), for indication of what the
expected behaviour is.
(^_^)/
mike.
"Garvin, Michael [CAR:C28G:EXCH]" <mg*****@americasm01.nt.com> wrote in
message news:cl**********@zcars0v6.ca.nortel.com... Cool, thanks for the tip!
I've been hunting through the literature on impact analysis. The research seems to be more abstract though, at a level where they assume you have
the abstract grammar graph for the entire system. Such analysis is valuable, but unfortunately, I have to work on things incrementally. The bodies of code I work on have 10s of millions of lines code :( I simply can't construct the whole graph at once, I have to walk from a given starting (changed!) type outwards. Hence my focus on trying to narrow down the candidate places to look for impacts :)
Thanks again for the info,
(^_^)/ mike.
"Bob Hairgrove" <in*****@bigfoot.com> wrote in message news:2u********************************@4ax.com... On Mon, 18 Oct 2004 15:55:50 -0400, "Garvin, Michael [CAR:C28G:EXCH]" <mg*****@americasm01.nt.com> wrote:
Hi I'm working on some impact analysis stuff for C++. I was wondering
ifanyone has seen an example of a type (lets say type "A") change
impactingthe storage/layout another type (lets say type "B"), but B does not includethe header/src file where A is defined. Also B is using type A by more than just a pointer, that is B needs to knowthe size/layout of A.
For most (all?) complex types, I presume that the compiler must see the fulldeclaration of the type its using, in order to know the size,
alignment,layout etc. Is there any sneaky way around this, that I might have to account for when trying to find the impact of a changed type?
Another way to ask this question; if I know exactly which header file type Ais defined in, and I know that type A has changed in size/layout, can I assume that only the files which include type A's header are candidate users? ...the places where some other type might possibly use type A
It's a good starting point.
It sounds like a reasonable assumption, but there are lots of sneaky thingsthat can be done in C++. :( Maybe there is a way around this assumption? If inclusion of headers is "well-behaved", i.e. you don't change alignment or struct packing somewhere with #pragma's before including it, this should be sufficient.
Thanks in advance for any tips or examples that you've encountered...
(^_^)/ mike.
mg*****@nortelnetworks.com
-- Bob Hairgrove No**********@Home.com
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: dcolford2000 |
last post by:
Hi All - I'm new to python
Is there an impact analysis tool out there that can cross reference
python -- VB has a couple of these tools (eg. Visual Expert)
TIA, All comments welcome
Dave
|
by: Aaron Anodide |
last post by:
Hello,
I am using the following template class as a shorthand for zero-ing memory:
template<class T>
class ZeroMem : public T
{
public:
ZeroMem(void)
|
by: wenmang |
last post by:
Hi, all:
I try to understand whether it is a portable to cast a pointer type,
e.g.,
char *ptr = char array; -- a buffer
unsigned char *uptr = ptr;
:
:
function(uptr); -- execute a function...
|
by: hpy_awad |
last post by:
I wrote that example from a book and there is en error in the display
module that it does not showing all the records are entered in the
input module.
I traced with some printf statments without...
|
by: Matt |
last post by:
I have a production database that I need to change the logging type
from circular to archived so that I can do online backups. The
database is not particularly large, but is used by many people. ...
|
by: Rich |
last post by:
Hi,
I know HOW to run these side by side. But what is the performance impact???
Microsoft make a big deal about how it is supported, but provide no
guidelines as to potential performace or...
|
by: Mark |
last post by:
We are building a public web application that calls a web service on an
internal box. The web service runs for 5-10 minutes, does some heavy
processing, and writes to a database when it is...
|
by: Sugandh Jain |
last post by:
Hi,
The warning from Microsoft.Performance Code Analysis check that,
its not required to initialize numeric variables to zero, boolean to false
and object to null is a good one because CLR does...
|
by: RK |
last post by:
I'm exploring javascript as a newbie, and have noted that the DocType
has a substantial impact on some of the things I'm trying to do. I
guess certain features have been deprecated, and do not...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |