diff options
author | Petr Onderka <gsvick@gmail.com> | 2016-03-10 19:32:25 +0100 |
---|---|---|
committer | Petr Onderka <gsvick@gmail.com> | 2016-03-10 19:32:25 +0100 |
commit | 04dc1e0fe809ef973f0d8d3e00d17fa4f0d4f524 (patch) | |
tree | 18b469ac0873e70145474f8ee60a5d51960277d2 /Documentation/botr | |
parent | 43cc989069c400c939f1d4df878876523bf336ed (diff) | |
download | coreclr-04dc1e0fe809ef973f0d8d3e00d17fa4f0d4f524.tar.gz coreclr-04dc1e0fe809ef973f0d8d3e00d17fa4f0d4f524.tar.bz2 coreclr-04dc1e0fe809ef973f0d8d3e00d17fa4f0d4f524.zip |
Remove incorrect escaping in example in BOTR
The example was casting to `ArrayMethodDesc\*` (note the backslash, possibly there to avoid italics formatting in some previous version?), which doesn't make sense. Now it casts to `ArrayMethodDesc*`.
Also, since I'm already changing this snippet, enable syntax highlighting as C++ for it.
Diffstat (limited to 'Documentation/botr')
-rw-r--r-- | Documentation/botr/method-descriptor.md | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Documentation/botr/method-descriptor.md b/Documentation/botr/method-descriptor.md index ae548c432f..bce0bff340 100644 --- a/Documentation/botr/method-descriptor.md +++ b/Documentation/botr/method-descriptor.md @@ -69,16 +69,18 @@ Alternative Implementations Virtual methods and inheritance would be the natural way to implement various kinds of MethodDesc in C++. The virtual methods would add vtable pointer to each MethodDesc, wasting a lot of precious space. The vtable pointer occupies 4 bytes on x86. Instead, the virtualization is implemented by switching based on the MethodDesc kind, which fits into 3 bits. For example: - DWORD MethodDesc::GetAttrs() - { - if (IsArray()) - return ((ArrayMethodDesc\*)this)->GetAttrs(); - - if (IsDynamic()) - return ((DynamicMethodDesc\*)this)->GetAttrs(); - - return GetMDImport()->GetMethodDefProps(GetMemberDef()); - } +```c++ +DWORD MethodDesc::GetAttrs() +{ + if (IsArray()) + return ((ArrayMethodDesc*)this)->GetAttrs(); + + if (IsDynamic()) + return ((DynamicMethodDesc*)this)->GetAttrs(); + + return GetMDImport()->GetMethodDefProps(GetMemberDef()); +} +``` Method Slots ------------ |