Rosario19 <Ros@invalid.invalid>: May 07 10:58PM +0200 On Sat, 07 May 2016 22:27:49 +0200, Rosario19 wrote: >sizeof(void*) or one size of pointer >the obj "a" is in the memory returned from malloc() [or one stack >allocator] thru its constructor [that call malloc() or new[] ] as in some C++ constructor |
Rosario19 <Ros@invalid.invalid>: May 07 11:00PM +0200 On Sat, 07 May 2016 22:58:22 +0200, Rosario19 wrote: >>so ((u8*)a)[0..sizeof(obj)] is where the obj is... ((u8*)a)[0..sizeof(obj)-1] |
Rosario19 <Ros@invalid.invalid>: May 07 11:01PM +0200 On Sat, 07 May 2016 23:17:31 +0300, Paavo Helde wrote: >(PS. I never reply to Rosario19 directly because he (or she or it) is >apparently not capable to keep up a coherent conversation.) prrrrrrrrrrrrrrrrrrrr |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: May 07 02:34PM -0700 On Saturday, May 7, 2016 at 4:58:30 PM UTC-4, Rosario19 wrote: > >allocator] > thru its constructor [that call malloc() or new[] ] as in some C++ > constructor We can test it. Create this, compile it in your compiler and have it either generate output assembly, or single-step through the disassembly at runtime, and you will see where the data for a is allocated: #include <stdio.h> class CMyClass { public: CMyClass(int a) { m_a = a; } ~CMyClass() { } void output(void) { printf("%d\n", m_a); } private: int m_a; }; int main(int argc, char **argv) { CMyClass w(2); w.output(); } And you see what code is called on the CMyClass w(2); line. You'll see that it uses allocation on the stack and never calls malloc() or its equivalents. > >0xFF00FF to 0xFF00FF+sizeof(obj) > >there is the "a" obj > >so ((u8*)a)[0..sizeof(obj)] is where the obj is... The a in "ClassName a;" will reside at (u8*)&a[0..sizeof(a)-1]. Best regards, Rick C. Hodgin |
Rosario19 <Ros@invalid.invalid>: May 08 12:01AM +0200 On Sat, 7 May 2016 14:34:12 -0700 (PDT), "Rick C. Hodgin" wrote: > CMyClass w(2); > w.output(); > } i already know above in the stack there is here [if i remember well ] one int in above case... if the class has in it {.... int m_a,m_b,m_c;} the class would have 3 int int in the stack etc but i say somethig as this #include <stdio.h> class CMyClass {public: CMyClass(int a) {// this is the address of w in the stack *this=malloc(sizeof(class CMyClass)); // if to this above is assigned the memory // "int m_a;" begin to exist... so m_a=a // should be ok if(*this) m_a=a; } ~CMyClass() { free(*this); } void output(void) { printf("%d\n", m_a); } int m_a; }; int main(int argc, char **argv) { CMyClass w(2); w.output(); } but this code not exist nor compile etc |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: May 07 03:32PM -0700 On Saturday, May 7, 2016 at 6:01:50 PM UTC-4, Rosario19 wrote: > w.output(); > } > but this code not exist nor compile etc If you were only using allocated classes it would work. But the existing class structure allows class data to exist in the global heap, or in local stack space, so your proposal won't work because those resources don't need to be free()'d in the same way. > >> >there is the "a" obj > >> >so ((u8*)a)[0..sizeof(obj)] is where the obj is... > >The a in "ClassName a;" will reside at (u8*)&a[0..sizeof(a)-1]. Best regards, Rick C. Hodgin |
Ramine <ramine@1.1>: May 07 05:30PM -0700 Hello...... C++ synchronization objects library was updated again... Now it is compatible with GNU C++ and Visual C++ and C++ Builder.. i have just included the C++ Builder makefiles. You can download my new C++ synchronization objects library: https://sites.google.com/site/aminer68/c-synchronization-objects-library Thank you, Amine Moulay Ramdane. |
bleachbot <bleachbot@httrack.com>: May 07 11:28PM +0200 |
"Öö Tiib" <ootiib@hot.ee>: May 06 11:07PM -0700 On Friday, 6 May 2016 04:32:58 UTC+3, Alf P. Steinbach wrote: > Side note: what does one call something when Microsoft calls it "info"? > In this case it's a set of values that specify the properties of a console. I think of "info" as "answer to question of some kind". It can have more accurate name to it (in context). If the info is carrying properties or settings then saying that out in name may be better. Regardless of the name when there is a "manager" of same thing (say "console_screen_buffer_manager") then that is considered "Doer And Knower" antipattern by many. If it is not meant for language-neutral usage then lot of people prefer scopes and qualification in C++ to long names (like "console::screen_buffer::settings"). |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: May 07 12:53PM +0200 On 07.05.2016 08:07, Öö Tiib wrote: > If it is not meant for language-neutral usage then lot of people > prefer scopes and qualification in C++ to long names (like > "console::screen_buffer::settings"). "settings" is good. Thank you. Cheers!, - Alf |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment