General discussion

Locked

C++ Forum

By Mark W. Kaelin Editor ·
Welcome to the C++ Forum. This is the place to post your C++ questions, share your best techniques, and express your opinion on topics that impact IT development.

We also encourage you to post your comments about the C++ TechMail.

If you haven't subscribed to the C++ TechMail, there is no better time to take advantage of our free e-newsletter. Visit our e-newsletter subscription center to subscribe to this valuable TechMail today:

http://builder.com.com/techmails.jhtml?repID=u001

This conversation is currently closed to new comments.

22 total posts (Page 1 of 3)   01 | 02 | 03   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

C++ TechMail

by Mark W. Kaelin Editor In reply to C++ Forum

Understand the benefits of smart pointers:

The Feb. 12, C++ TechMail discusses the benefits of smart pointers. Have you used smart pointers in your application development? Share your experiences.

Collapse -

free memory

by dairoc In reply to C++ TechMail

I have a question. When i use smart pointer and ends with an exception it's necessary in order to free the smart pointer with the RELEASE command.
My application consumes to much memory.
Thanks

Collapse -

usually not

by John Torjo In reply to free memory

Hi,

It depends on the type of smart pointer you use.
Usually that's the purpose of a smart pointer: so that you don't have to remember to release the pointed object, even in the presense of exceptions. Therefore, you should not have to manually release it (but do check the documentation of the smart pointer you use).

Best,
John

Collapse -

C++ TechMail Discussion Question

by Mark W. Kaelin Editor In reply to C++ Forum

Learn about the placement new operator:

The Feb. 19, C++ TechMail discusses memory allocation with the placement new operator. Have you used placement new to preallocate memory in your applications? Tell how you used it and why.

Collapse -

alignment and 100 xtra allocation

by solrak29 In reply to C++ TechMail Discussion Q ...

Where does alignment come into play?
And why allocate the extra 100 bytes?

Pleas email me if you reply...solrak29@yahoo.com

Collapse -

re:

by John Torjo In reply to alignment and 100 xtra al ...

Alignment comes into play with more complex structures, on certain platforms. For example, on certain platforms a 'long' variable can be found only at addresses that are multiple of 4 (0x00000004, 0x00000008,0x0000000C, etc.).
Alignment is a very delicate issue in itsown.

Click here for a pretty advanced article:
http://www.cuj.com/experts/2004/alexandr.htm?topic=experts
http://www.cuj.com/experts/2006/alexandr.htm?topic=experts
http://www.cuj.com/experts/2008/alexandr.htm?topic=experts


To my shame, the extra 100 bytes - it was mistake - it was no need for them.

Best,
John

Collapse -

pointer addition

by mohn3310 In reply to C++ TechMail Discussion Q ...

Some simple stuff but just wanted to check...

strBuff is a char pointer to a chunch of memory. So if you add to this pointer (base) you will point to the next character or byte.

When this pointer is cast to a CTest pointer, adding to it will move sizeof( CTest ) ahead.

Collapse -

yes.

by John Torjo In reply to pointer addition

> When this pointer is cast to a CTest pointer, adding to it will move sizeof( CTest ) ahead.

Yes, indeed.

For the sake of the example, I used a char array to symbolize an array of bytes - indeed just a chunk of memory. And on this chunk, wecan create objects using placement new.

Best,
John

Collapse -

C++ TechMail Question

by Mark W. Kaelin Editor In reply to C++ Forum

Test code with a simple framework, part 1:

A recent C++ TechMail discusses testing methods. How do you test your C++ code? Do you write test routines as suggested in the tip? Tell us your best techniques for testing code.

Collapse -

nice, but?

by solrak29 In reply to C++ TechMail Question

I like the use of asserts in the testing code.
Also I like the fact of creating a testing directory and organizing your code, but litering
you code with ifdefs for testing can get harry. But I do understand that certain parts of the code can and/or should not executed when testing, but your missing the actual value of unit testing...right? I would rather take the extreme programming approach and design your code for testing. Thus, make sure your class, functions, or whatever are testable within the framework and you dont have to put ifdef in the production code.


It seesm straight forward, but the anonymous namespace only allows functions in the same file access...????

Back to Web Development Forum
22 total posts (Page 1 of 3)   01 | 02 | 03   Next

Related Discussions

Related Forums