C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  14 Posts :: 0 Stories :: 214 Comments :: 0 Trackbacks









class   H;
class   S
        x()   {
                H*   pThis=this-offsetof(m_s,   H);
class   H
        S   m_s;
H里包含S的对象,在S里,为了获得宿主类H的指针,用自身的this指针减去m_s在H中的偏移量。这就要求一个类中的子对象必须同宿主对象放在一起 (连续分布),并且固定(偏移量永远不变)。为了在对象布局上给予编译器充分的自由,标准规定offsetof只能用于pod。mfc仅考虑在   vc上使用,所以为了方便而仅仅面向vc编译器编码。这带来了移植性的问题。不过,编译器间的移植性还是小事。现在我们就可以看到mfc的这种做法是搬起 石头砸自己的脚。
sutter和lippman都不止一次地提到将来vc要能够不区分托管和本地的内存管理。也就是说托管的类型可以在native堆上分配,而   native的类型可以在托管堆上分配。问题来了,由于托管堆上,子对象和宿主对象的存放不是连续的,子对象可能同宿主对象隔着十万八千里,和成千上万的 对象。而且子对象可能会在宿主对象的前面。offset也是不确定的。在这种情况下,使用上面的这种代码无异于自杀。所以,为了实现托管和本地内存管理的 统一,必须放弃offsetof这类畸形代码。由此导致了mfc的大幅更新。
posted on 2007-11-15 15:14 longshanks 阅读(2505) 评论(118)  编辑 收藏 引用
评论共2页: 1 2 


# zovirax 2008-06-13 20:43 zovirax
As a well-spent day brings happy sleep, so life well used brings happy death.  回复  更多评论

# prozac online 2008-06-14 00:31 prozac online
So many of our dreams at first seem impossible, then they seem improbable, and then, when we summon the will, they soon become inevitable.  回复  更多评论

# order phentermine online 2008-06-14 00:37 order phentermine online
As soon as you trust yourself, you will know how to live.  回复  更多评论

# sildenafil 2008-06-14 00:40 sildenafil
I am here for a purpose and that purpose is to grow into a mountain, not to shrink to a grain of sand. Henceforth will I apply ALL my efforts to become the highest mountain of all and I will strain my potential until it cries for mercy.  回复  更多评论

# plavix 2008-06-14 04:20 plavix
Ask not what you can do for your country. Ask what's for lunch.  回复  更多评论

# gabapentin 2008-06-14 04:20 gabapentin
Music is essentially useless, as life is.  回复  更多评论

# generic plavix 2008-06-14 07:47 generic plavix
Sometimes love will pick you up by the short hairs...and jerk the heck out of you.  回复  更多评论

# alochia 2008-06-14 08:01 alochia
Enjoy your own life without comparing it with that of another.  回复  更多评论

# baster 2008-06-14 08:01 baster
Never eat more than you can lift.  回复  更多评论

# laplacian 2008-06-14 08:02 laplacian
To do anything truly worth doing, I must not stand back shivering and thinking of the cold and danger, but jump in with gusto and scramble through as well as I can.  回复  更多评论

# underexpanding 2008-06-14 08:04 underexpanding
Like anyone else, there are days I feel beautiful and days I don't, and when I don't, I do something about it.  回复  更多评论

# tramadol online 2008-06-14 11:33 tramadol online
'Never put off until tomorrow what you can do today.' Under the influence of this pestilent morality, I am forever letting tomorrow's work slop backwards into today's, and doing painfully and nervously today what I could do quickly and easily tomorrow.  回复  更多评论

# fluconazole 2008-06-14 11:35 fluconazole
Greatness is more than potential. It is the execution of that potential. Beyond the raw talent. You need the appropriate training. You need the discipline. You need the inspiration. You need the drive.  回复  更多评论

# zopiclone 2008-06-14 15:02 zopiclone
My mother loved children -- she would have given anything if I had been one.  回复  更多评论

# buy phentermine online 2008-06-14 15:03 buy phentermine online
Art is science made clear.  回复  更多评论

# imitrex 2008-06-14 15:04 imitrex
Noble life demands a noble architecture for noble uses of noble men. Lack of culture means what it has always meant: ignoble civilization and therefore imminent downfall.  回复  更多评论

# purchase valium 2008-06-14 15:06 purchase valium
What more felicity can fall to creature, than to enjoy delight with liberty.  回复  更多评论

# soma online 2008-06-14 15:17 soma online
Paradise is exactly like where you are right now... only much, much better.  回复  更多评论

# generic sildenafil 2008-06-14 15:19 generic sildenafil
Men of genius do not excel in any profession because they labor in it, but they labor in it because they excel.  回复  更多评论

# cialis 2008-06-14 15:21 cialis
I've grown to realize the joy that comes from little victories is preferable to the fun that comes from ease and the pursuit of pleasure.  回复  更多评论

# tramadol 2008-06-14 15:21 tramadol
The most beautiful adventures are not those we go to seek.  回复  更多评论

# generic ambien 2008-06-14 18:34 generic ambien
History is indeed little more than the register of the crimes, follies and misfortunes of mankind.  回复  更多评论

# ultracet 2008-06-14 18:36 ultracet
It is curious that physical courage should be so common in the world and moral courage so rare.  回复  更多评论

# buy vicodin online 2008-06-15 02:56 buy vicodin online
There is no stigma attached to recognizing a bad decision in time to install a better one.  回复  更多评论

# generic lipitor 2008-06-15 06:49 generic lipitor
What more felicity can fall to creature, than to enjoy delight with liberty.  回复  更多评论

# order viagra 2008-06-15 06:50 order viagra
Students achieving Oneness will move on to Twoness.  回复  更多评论

# fioricet online 2008-06-15 06:53 fioricet online
Editor: a person employed by a newspaper, whose business it is to separate the wheat from the chaff, and to see that the chaff is printed.  回复  更多评论

# generic prilosec 2008-06-15 10:20 generic prilosec
Flattery is like cologne water, to be smelt of, not swallowed.  回复  更多评论

# buy hydrocodone online 2008-06-15 13:47 buy hydrocodone online
Happiness is not a station you arrive at, but a manner of traveling.  回复  更多评论

# buy carisoprodol 2008-06-15 13:48 buy carisoprodol
There are worse things in life than death. Have you ever spent an evening with an insurance salesman?  回复  更多评论

# generic prilosec 2008-06-15 17:36 generic prilosec
Feet, why do I need them if I have wings to fly?  回复  更多评论

# citalopram nastily nevadite 2008-06-15 21:33 citalopram nastily nevadite
Always do right. This will gratify some people and astonish the rest.  回复  更多评论

# escitalopram 2008-06-16 01:04 escitalopram
It is not enough to aim; you must hit.  回复  更多评论

# zopiclone 2008-06-16 04:25 zopiclone
Preserving health by too severe a rule is a worrisome malady.  回复  更多评论

# buy zoloft 2008-06-16 08:14 buy zoloft
Summer afternoon - Summer afternoon... the two most beautiful words in the English language.  回复  更多评论

# meridia online 2008-06-16 11:41 meridia online
Keep true to the dreams of thy youth.  回复  更多评论

# soma 2008-06-16 15:28 soma
People will buy anything that is one to a customer.  回复  更多评论

# cheap tramadol 2008-06-16 15:32 cheap tramadol
History is more or less bunk.  回复  更多评论

# adipex 2008-06-16 19:12 adipex
What children take from us, they give?We become people who feel more deeply, question more deeply, hurt more deeply, and love more deeply.  回复  更多评论

# sertraline 2008-06-16 22:41 sertraline
There is only one success - to be able to spend your life in your own way.  回复  更多评论

# zyban 2008-06-16 22:44 zyban
There is nothing more dreadful than imagination without taste.  回复  更多评论

# zestril 2008-06-16 22:46 zestril
To have a right to do a thing is not at all the same as to be right in doing it.  回复  更多评论

# glucophage washdown hydroaromatic 2008-06-16 22:48 glucophage washdown hydroaromatic
Dance is the hidden language of the soul.  回复  更多评论

# buy vicodin online 2008-06-16 22:49 buy vicodin online
Reading well is one of the great pleasures that solitude can afford you.  回复  更多评论

# effexor 2008-06-17 02:01 effexor
My grandmother started walking five miles a day when she was sixty. She's ninety-seven now, and we don't know where the hell she is.  回复  更多评论

# generic zocor 2008-06-17 02:02 generic zocor
The aim of life is self-development. To realize one's nature perfectly - that is what each of us is here for.  回复  更多评论

# vardenafil 2008-06-17 05:44 vardenafil
Students achieving Oneness will move on to Twoness.  回复  更多评论

# azithromycin 2008-06-17 05:44 azithromycin
Is love supposed to last throughout all time, or is it like trains changing at random stops. If I loved her, how could I leave her? If I felt that way then, how come I don't feel anything now?  回复  更多评论

# generic wellbutrin 2008-06-17 09:32 generic wellbutrin
The real problem is not whether machines think but whether men do.  回复  更多评论

# generic wellbutrin 2008-06-17 09:34 generic wellbutrin
Music is essentially useless, as life is.  回复  更多评论

# neurontin tranquillize tracheoplasty 2008-06-17 09:34 neurontin tranquillize tracheoplasty
Beware the pull on your heartstrings -- it's often the pursestrings that are actually being reached for.  回复  更多评论

# order xenical 2008-06-17 09:35 order xenical
Depend not on fortune, but on conduct.  回复  更多评论

# darvon nix prescaler 2008-06-17 13:15 darvon nix prescaler
Learn the art of patience. Apply discipline to your thoughts when they become anxious over the outcome of a goal. Impatience breeds anxiety, fear, discouragement and failure. Patience creates confidence, decisiveness, and a rational outlook, which eventually leads to success.  回复  更多评论

# buy valium online 2008-06-17 16:53 buy valium online
You must not think me necessarily foolish because I am facetious, nor will I consider you necessarily wise because you are grave.  回复  更多评论

# order carisoprodol online 2008-06-17 20:03 order carisoprodol online
It is a paradoxical but profoundly true and important principle of life that the most likely way to reach a goal is to be aiming not at that goal itself but at some more ambitious goal beyond it.  回复  更多评论

# generic sildenafil 2008-06-17 23:39 generic sildenafil
It is better to wear out than to rust out.  回复  更多评论

# keflex 2008-06-18 03:16 keflex
When I came back to Dublin I was courtmartialed in my absence and sentenced to death in my absence, so I said they could shoot me in my absence.  回复  更多评论

# cialis online 2008-06-18 06:55 cialis online
From the moment I picked up your book until I laid it down, I was convulsed with laughter. Some day I intend reading it.  回复  更多评论

# levofloxacin 2008-06-18 06:56 levofloxacin
Nothing is more conducive to peace of mind than not having any opinions at all.  回复  更多评论

# buy fioricet 2008-06-18 10:31 buy fioricet
Is there life before death?  回复  更多评论

# buy alprazolam online 2008-06-18 10:38 buy alprazolam online
Most of the basic truths of life sound absurd at first hearing.  回复  更多评论

# valium online 2008-06-18 10:38 valium online
I feel about airplanes the way I feel about diets. It seems to me they are wonderful things for other people to go on.  回复  更多评论

# cheap viagra 2008-06-18 10:38 cheap viagra
Preserving health by too severe a rule is a worrisome malady.  回复  更多评论

# buy wellbutrin 2008-06-18 10:40 buy wellbutrin
Someone's boring me. I think it's me.  回复  更多评论

# ibuprofen 2008-06-18 14:12 ibuprofen
If you watch a game, it's fun. If you play at it, it's recreation. If you work at it, it's golf.  回复  更多评论

# generic zocor 2008-06-18 14:15 generic zocor
Take a two-mile walk every morning before breakfast.  回复  更多评论

# order xenical 2008-06-18 14:20 order xenical
You don't have to cook fancy or complicated masterpieces - just good food from fresh ingredients.  回复  更多评论

# zingerone 2008-06-18 14:23 zingerone
It had only one fault. It was kind of lousy.  回复  更多评论

# thermatology 2008-06-18 14:26 thermatology
Do what you feel in your heart to be right - for you'll be criticized anyway. You'll be damned if you do, and damned if you don't.  回复  更多评论

# madrono 2008-06-18 14:27 madrono
Sometimes the cure for restlessness is rest.  回复  更多评论

# alveola 2008-06-18 14:31 alveola
Cheese - milk's leap toward immortality.  回复  更多评论

# eukhsokw 2008-06-18 21:29 eukhsokw
<a href="http://pdpaylfv.com">uvfpkkkw</a> jnfxqzub http://gecrgyll.com xcmjjbxt lhmwhfxf [URL=http://cuxkcnri.com]nbezyohq[/URL]   回复  更多评论

# buy soma 2008-06-19 02:52 buy soma
The only thing that saves us from the bureaucracy is inefficiency. An efficient bureaucracy is the greatest threat to liberty.  回复  更多评论

# ionamin 2008-06-19 02:52 ionamin
I don't generally feel anything until noon; then it's time for my nap.  回复  更多评论

# buy soma 2008-06-19 02:54 buy soma
People fail forward to success.  回复  更多评论

# order valium online complexion dioctahedron 2008-06-19 02:55 order valium online complexion dioctahedron
The first precept was never to accept a thing as true until I knew it as such without a single doubt.  回复  更多评论

# imitrex 2008-06-19 02:56 imitrex
I'm all in favor of keeping dangerous weapons out of the hands of fools. Let's start with typewriters.  回复  更多评论

# generic valium dezincification fatuously 2008-06-19 06:50 generic valium dezincification fatuously
I must create a system, or be enslaved by another man's.  回复  更多评论

# testosterone 2008-06-19 06:50 testosterone
My home is not a place, it is people.  回复  更多评论

# cialis online 2008-06-19 06:51 cialis online
They can conquer who believe they can.  回复  更多评论

# propecia online 2008-06-19 11:15 propecia online
Nothing great in the world has been accomplished without passion.  回复  更多评论

# paroxetine 2008-06-19 15:11 paroxetine
I don't own a cell phone or a pager. I just hang around everyone I know, all the time. If someone wants to get a hold of me, they just say 'Mitch,' and I say 'what?' and turn my head slightly.  回复  更多评论

# cheap propecia 2008-06-19 18:32 cheap propecia
Noble life demands a noble architecture for noble uses of noble men. Lack of culture means what it has always meant: ignoble civilization and therefore imminent downfall.  回复  更多评论

# prednisone 2008-06-19 18:35 prednisone
Hollywood is a place where they place you under contract instead of under observation.  回复  更多评论

# generic sildenafil 2008-06-19 21:53 generic sildenafil
When we are unhurried and wise, we perceive that only great and worthy things have any permanent and absolute existence, that petty fears and petty pleasures are but the shadow of the reality.  回复  更多评论

# buspirone 2008-06-20 01:18 buspirone
Men are equal; it is not birth but virtue that makes the difference.  回复  更多评论

# buy ambien online 2008-06-20 01:19 buy ambien online
All men are frauds. The only difference between them is that some admit it. I myself deny it.  回复  更多评论

# soma 2008-06-20 01:19 soma
Excess on occasion is exhilarating. It prevents moderation from acquiring the deadening effect of a habit.  回复  更多评论

# buy diazepam 2008-06-20 01:20 buy diazepam
The dead might as well try to speak to the living as the old to the young.  回复  更多评论

# cipro 2008-06-20 01:21 cipro
Men are equal; it is not birth but virtue that makes the difference.  回复  更多评论

# tadalafil 2008-06-20 05:06 tadalafil
I have come to the conclusion that politics are too serious a matter to be left to the politicians.  回复  更多评论

# buy alprazolam online 2008-06-20 05:07 buy alprazolam online
A conference is a gathering of important people who singly can do nothing, but together can decide that nothing can be done.  回复  更多评论

# tretinoin 2008-06-20 08:58 tretinoin
Writing gives you the illusion of control, and then you realize it's just an illusion, that people are going to bring their own stuff into it.  回复  更多评论

# carisoprodol online thermostriction hypophoria 2008-06-20 12:15 carisoprodol online thermostriction hypophoria
My friends are my estate.  回复  更多评论

# order vicodin abrin irritable 2008-06-20 15:45 order vicodin abrin irritable
How we treasure (and admire) the people who acknowledge us!  回复  更多评论

# cheap xanax 2008-06-20 15:49 cheap xanax
Prove all things; hold fast that which is good.  回复  更多评论

# vardenafil 2008-06-20 15:55 vardenafil
Whoso would be a man must be a nonconformist.  回复  更多评论

# buy phentermine 2008-06-20 20:14 buy phentermine
Keep your broken arm inside your sleeve.  回复  更多评论

# order valium online 2008-06-20 20:16 order valium online
We cannot destroy kindred: Our chains stretch a little sometimes, but they never break.  回复  更多评论

# Website Traffic 2009-10-12 22:38 annarogers98@gmail.com
What a nice blog you have..thanks for all this information.  回复  更多评论

评论共2页: 1 2 

【推荐】超50万行VC++源码: 大型组态工控、电力仿真CAD与GIS源码库
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理