- I want to ask a question... - 5 Updates
- packaged_task - 2 Updates
- cmsg cancel <mq2uo6$dpj$2@dont-email.me> - 2 Updates
- Announcement: "cpp-mmf" C++98 library released - 3 Updates
- We have new requirement for System Analyst role at Fort worth, TX, 6Months. - 1 Update
Ramine <ramine@1.1>: Aug 07 02:53PM -0700 Hello, I want to ask a question... Suppose that you are using a pointer that points to an allocated chunk of memory, and suppose that you deallocated this chunk of memory and you have keeped the old address of this pointer inside another pointer , is there a problem to access the old address of the pointer and content of the memory even if it was deallocated ? I am experimenting with that inside FreePascal compiler and it doesn't give a problem.. can you confirm that there is or there is no problem ? Thank you, Amine Moulay Ramdane. |
Ramine <ramine@1.1>: Aug 07 03:06PM -0700 Hello, I have just received an answer from Gareth Owen from the comp.lang.c forum: Here it is: "You can access the pointer itself, but you can't access the memory it points to. Sometimes it might work - and it simple programs it probably will work more ofhen than not - but you can't rely on it. Don't do that." So i will not do that. Thank you, Amine Moulay Ramdane. |
red floyd <no.spam@its.invalid>: Aug 07 12:07PM -0700 On 8/7/2015 2:53 PM, Ramine wrote: > you have keeped the old address of this pointer inside another pointer , > is there a problem to access the old address of the pointer and content > of the memory even if it was deallocated ? It's undefined behavior. Which means that anything can happen, ranging from "appears to work correctly" to segfaults to "reformats your hard drive and installs Windows Vista". |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Aug 07 09:09PM +0200 On 07-Aug-15 11:53 PM, Ramine wrote: > you have keeped the old address of this pointer inside another pointer , > is there a problem to access the old address of the pointer and content > of the memory even if it was deallocated ? Yes. > I am experimenting with that inside FreePascal compiler and > it doesn't give a problem.. can you confirm that there is or > there is no problem ? One common effect of Undefined Behavior is that what one naively expects will happen, happens, but possible problems include * That there is hardware-supported checking of pointer values, generating some trap. * The the relevant memory page is no longer in use, again with a possible trap (hardware exception) as result. * That the code changes memory that is now used for something else. * That the code incorrectly uses data that has been changed due to the memory block being used for something else. * That the C or C++ compiler emits code that detects the situation. On the PC platform, which seems to be indicated by "FreePascal compiler", the first point is not so likely, because everything is set up to use a common single large segment for code, data and stack, and offsets in one big segment are not so easy to check for validity. Cheers & hth., - Alf -- Using Thunderbird as Usenet client, Eternal September as NNTP server. |
Vir Campestris <vir.campestris@invalid.invalid>: Aug 07 09:56PM +0100 On 07/08/2015 23:06, Ramine wrote: > will work more ofhen than not - but you can't rely on it. > Don't do that." > So i will not do that. The problem comes when some other part of the program allocates memory. It's quite likely to get the bit you freed, in which case you now have two parts of the program writing different things into the same place. If you're on Linux Valgrind can help catch these things. ISTR Visual Studio has some tools too. Andy |
Doug Mika <dougmmika@gmail.com>: Aug 07 12:50PM -0700 I want to create a queue of tasks to execute at a later date. I use packaged_task to create a list of tasks that I push onto the queue. However, when you create a task you do not provide the parameters for the task until it is invoked. I want to push tasks so that the parameters needed to run the tasks are already specified so that when I will invoke the task I'll be able to do it without specifying the parameters. Is there a way to create a task with the parameters passed into the task without invoking it? I guess the other option would be to invoke the tasks straight away and push the futures onto the queue and pop futures off of the queue, but I would prefer to invoke the tasks (and I don't wish to pass and hold the needed parameters on the queue as well)? |
Kalle Olavi Niemitalo <kon@iki.fi>: Aug 08 12:00AM +0300 > push tasks so that the parameters needed to run the tasks are > already specified so that when I will invoke the task I'll be > able to do it without specifying the parameters. How about using a lambda expression and capturing the parameters by value: extern void f(int i); std::queue<std::packaged_task<void()>> q1; for (int i = 0; i < 10; ++i) { q1.emplace( [=]() { f(i); } ); } |
bleachbot <bleachbot@httrack.com>: Aug 07 08:53PM +0200 |
bleachbot <bleachbot@httrack.com>: Aug 07 09:06PM +0200 |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Aug 07 02:59PM +0100 > I recently released the open source library "cpp-mmf": > https://github.com/carlomilanesi/cpp-mmf > It encapsulates memory-mapped files for both POSIX and Windows operating systems. Does the Boost alternative support more than just POSIX and Windows? > It has the same purpose and the same run-time speed of the "Memory-Mapped Files" Boost library, but it offers the following advantages: > * It has no dependencies on other libraries, except, of course, the operating system headers. > * It is faster to compile. Using Linux, it is about 5 times as fast to compile than using Boost. Compilation time is hardly an important consideration when choosing a library. > * It generates smaller code. Using Linux, it generates a stripped program that is less than a third of the one generated using Boost. A third less isn't even an order of magnitude. > * It has a better tutorial. Why don't you contribute to a better Boost tutorial? /Flibble |
c.milanesi.bg@gmail.com: Aug 07 11:58AM -0700 Mr Flibble wrote: > > https://github.com/carlomilanesi/cpp-mmf > > It encapsulates memory-mapped files for both POSIX and Windows operating systems. > Does the Boost alternative support more than just POSIX and Windows? I think not. However, if you know of other operating systems supporting memory-mapped files, and for which there is a significant number of C++ programmers needing them, tell me. > Compilation time is hardly an important consideration when choosing a > library. I usually take compilation time into account. If you compile once a day, and your compilation takes less than 5 seconds, it is irrelevant. But if you compile once ever ten minutes, and your compilation takes 5 minutes, it is very relevant. > > * It generates smaller code. Using Linux, it generates a stripped program that is less than a third of the one generated using Boost. > A third less isn't even an order of magnitude. It is "less than a third" (with Clang for Linux), not "a third less". A small program compiled with GCC or Clang, creates executable programs of the following sizes in byes: cpp-mmf Boost gcc for Windows 11264 24576 gcc for Linux 9836 26292 Clang for Linux 8572 29224 I wasn't able to compile it with Visual C++ and Boost. > > * It has a better tutorial. > Why don't you contribute to a better Boost tutorial? Because I don't like it. Why don't you contribute to cpp-mmf by trying to use it, and telling me what you don't like of it? -- Carlo Milanesi |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Aug 07 08:02PM +0100 > Why don't you contribute to cpp-mmf by trying to use it, and telling me what you don't like of it? Probably because boost would meet my needs if I ever wanted to use a memory mapped file (which is hardly ever). /Flibble |
bob.compugra@gmail.com: Aug 07 07:40AM -0700 Hi Iam Bob from Compugra Systems,Inc,We have new requirement for System Analyst role at Fort worth, TX, 6Months. Job title : System Analyst role Location : Fort worth, TX Relevant experience : 10+ years Job Description : Skills Required: * Bachelor's Degree in Computer Science, Computer Information Systems, Management Information Systems, or equivalent degree/experience * 10+ years of experience in Business Analysis and Systems Analysis disciplines * Must have experience in developing Enterprise level applications using different technology * Ability to interpret XML * Ability to work on multiple Projects * Understanding of Secondary Pricing across investor products/guidelines * Excellent interpersonal and verbal/written communication skills a must * Excellent organizational and analytical skills a must * Correspondent/retail origination experience * Ability to work with data, spot trends and draw conclusions is critical * Mortgage Loan Servicing experience and Warehouse Lending must Detailed JD / Responsibility : * Participate in development and review of all of the artifacts such as Business Requirement document, functional specifications, and QA test plan. * Elicit business requirements, and interpret them into practical technical solutions * Interact and coordinate with system developers and business subject matter experts on application changes, development, and deployment * Create and maintain system and user documentation * Provide regular verbal and written reports to management and business community * Participate in systems and processes design and implementation efforts. Remarks/ Special Needs: * This position requires some planned and unplanned overtime * Must have supported a production website, or customer facing production application (24x7) * Requires critical thinking to identify and resolve production issues with little, or no direction * Must have experience in managing deployment events (pre-deployment validation, coordinating the deployment with various teams & post-deployment validation confirmation) * Must be able to communicate well with others with little, or no direction Please fill below details. SL. No. Required Details Full Name of the candidate Current Location (Full Address - required for Background check) Availability Email Id Phone DOB Relocation (Yes or No) Immigration status Number of Layers Availability for Interview Skype ID MIA (Signed or Not Signed) - Thanks & Regards Bob COMPUGRA SYSTEMS INC ll Business Intelligence People ll 1 Crag wood Road, Suite # 101, S. Plainfield, NJ - 07080 Phones: 908.821.9120 Ext 319 Fax 302 269 3500; 908-821-9121 Email: Bob@compugra.com Visit us at: www.compugra.com |
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