MESSAGE
DATE | 2016-11-29 |
FROM | Ruben Safir
|
SUBJECT | Subject: [Learn] Look at this exciting output by my test program
|
From learn-bounces-at-nylxs.com Tue Nov 29 00:53:17 2016 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: from www.mrbrklyn.com (www.mrbrklyn.com [96.57.23.82]) by mrbrklyn.com (Postfix) with ESMTP id 4C72C161315; Tue, 29 Nov 2016 00:53:17 -0500 (EST) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from [10.0.0.62] (flatbush.mrbrklyn.com [10.0.0.62]) by mrbrklyn.com (Postfix) with ESMTP id 1AA88160E77; Tue, 29 Nov 2016 00:53:06 -0500 (EST) From: Ruben Safir To: Hangout , learn-at-nylxs.com Message-ID: <32e7ca42-85ec-7594-f6cf-5d0a0bf3a8fc-at-mrbrklyn.com> Date: Tue, 29 Nov 2016 00:53:06 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 Subject: [Learn] Look at this exciting output by my test program X-BeenThere: learn-at-nylxs.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: learn-bounces-at-nylxs.com Sender: "Learn"
[ruben-at-flatbush lvalue]$ make g++ -Wall -ggdb -pg -pg -pthread -o lvalue.exe lvalue.c [ruben-at-flatbush lvalue]$ ./lvalue.exe 4 5 6 7 8 9 6 5 4 3 2 1 *** Error in `./lvalue.exe': free(): invalid next size (fast): 0x0000000001ce6a80 *** ======= Backtrace: ========= /usr/lib/libc.so.6(+0x70c4b)[0x7fac24da2c4b] /usr/lib/libc.so.6(+0x76fe6)[0x7fac24da8fe6] /usr/lib/libc.so.6(+0x777de)[0x7fac24da97de] ./lvalue.exe[0x4017a7] ./lvalue.exe[0x40167c] ./lvalue.exe[0x401457] ./lvalue.exe[0x401164] ./lvalue.exe[0x400f3c] ./lvalue.exe[0x400cdf] /usr/lib/libc.so.6(__libc_start_main+0xf1)[0x7fac24d52291] ./lvalue.exe[0x400a1a] ======= Memory map: ======== 00400000-00403000 r-xp 00000000 08:06 454002297 /home/ruben/src/grad_school/thesis/lvalue/lvalue.exe 00602000-00603000 r--p 00002000 08:06 454002297 /home/ruben/src/grad_school/thesis/lvalue/lvalue.exe 00603000-00604000 rw-p 00003000 08:06 454002297 /home/ruben/src/grad_school/thesis/lvalue/lvalue.exe 01cd3000-01cf5000 rw-p 00000000 00:00 0 [heap] 7fac20000000-7fac20021000 rw-p 00000000 00:00 0 7fac20021000-7fac24000000 ---p 00000000 00:00 0 7fac24d32000-7fac24ec7000 r-xp 00000000 08:05 33580983 /usr/lib/libc-2.24.so 7fac24ec7000-7fac250c6000 ---p 00195000 08:05 33580983 /usr/lib/libc-2.24.so 7fac250c6000-7fac250ca000 r--p 00194000 08:05 33580983 /usr/lib/libc-2.24.so 7fac250ca000-7fac250cc000 rw-p 00198000 08:05 33580983 /usr/lib/libc-2.24.so 7fac250cc000-7fac250d0000 rw-p 00000000 00:00 0 7fac250d0000-7fac250e8000 r-xp 00000000 08:05 33580546 /usr/lib/libpthread-2.24.so 7fac250e8000-7fac252e7000 ---p 00018000 08:05 33580546 /usr/lib/libpthread-2.24.so 7fac252e7000-7fac252e8000 r--p 00017000 08:05 33580546 /usr/lib/libpthread-2.24.so 7fac252e8000-7fac252e9000 rw-p 00018000 08:05 33580546 /usr/lib/libpthread-2.24.so 7fac252e9000-7fac252ed000 rw-p 00000000 00:00 0 7fac252ed000-7fac25303000 r-xp 00000000 08:05 33580527 /usr/lib/libgcc_s.so.1 7fac25303000-7fac25502000 ---p 00016000 08:05 33580527 /usr/lib/libgcc_s.so.1 7fac25502000-7fac25503000 r--p 00015000 08:05 33580527 /usr/lib/libgcc_s.so.1 7fac25503000-7fac25504000 rw-p 00016000 08:05 33580527 /usr/lib/libgcc_s.so.1 7fac25504000-7fac25607000 r-xp 00000000 08:05 39112638 /usr/lib/libm-2.24.so 7fac25607000-7fac25806000 ---p 00103000 08:05 39112638 /usr/lib/libm-2.24.so 7fac25806000-7fac25807000 r--p 00102000 08:05 39112638 /usr/lib/libm-2.24.so 7fac25807000-7fac25808000 rw-p 00103000 08:05 39112638 /usr/lib/libm-2.24.so 7fac25808000-7fac25980000 r-xp 00000000 08:05 33581159 /usr/lib/libstdc++.so.6.0.22 7fac25980000-7fac25b80000 ---p 00178000 08:05 33581159 /usr/lib/libstdc++.so.6.0.22 7fac25b80000-7fac25b8a000 r--p 00178000 08:05 33581159 /usr/lib/libstdc++.so.6.0.22 7fac25b8a000-7fac25b8c000 rw-p 00182000 08:05 33581159 /usr/lib/libstdc++.so.6.0.22 7fac25b8c000-7fac25b90000 rw-p 00000000 00:00 0 7fac25b90000-7fac25bb3000 r-xp 00000000 08:05 33580982 /usr/lib/ld-2.24.so 7fac25d67000-7fac25d6d000 rw-p 00000000 00:00 0 7fac25db1000-7fac25db2000 rw-p 00000000 00:00 0 7fac25db2000-7fac25db3000 r--p 00022000 08:05 33580982 /usr/lib/ld-2.24.so 7fac25db3000-7fac25db4000 rw-p 00023000 08:05 33580982 /usr/lib/ld-2.24.so 7fac25db4000-7fac25db5000 rw-p 00000000 00:00 0 7ffeae632000-7ffeae653000 rw-p 00000000 00:00 0 [stack] 7ffeae7de000-7ffeae7e1000 r--p 00000000 00:00 0 [vvar] 7ffeae7e1000-7ffeae7e3000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] Aborted
I wish someone was around who know C++ enough to diagnose this /* * ===================================================================================== * * Filename: lvalue.c * * Description: test of vector being used as an lvalue * * Version: 1.0 * Created: 11/28/2016 12:31:54 PM * Revision: none * Compiler: gcc * * Author: Ruben Safir (mn), ruben-at-mrbrklyn.com * Company: NYLXS Inc * * ===================================================================================== */
#include #include
namespace vect{
/* * ===================================================================================== * Class: Lvalue * Description: testing vector access as an lvalue * ===================================================================================== */
template < class T > class Lvalue { public:
// ==================== LIFECYCLE ======================================= Lvalue (){}; /* constructor */ Lvalue (std::vector in): _ofthings{in}{}; /* constructor */ Lvalue ( const Lvalue &other ); /* copy constructor */ ~Lvalue (){}; /* destructor */
/* ==================== ACCESSORS ======================================= */ T& ofthings(){ return _ofthings; };
void ofthings(std::vector const vec){ _ofthings = vec; }; /* ==================== MUTATORS ======================================= */
/* ==================== OPERATORS ======================================= */
const Lvalue& operator = ( const Lvalue &other ); // assignment operator const T& operator [] (int index) { return ofthings()[index]; }; friend std::ostream &operator << (std::ostream &os, Lvalue in) { for(int i = 0; i < in._ofthings.size(); i++ ){ std::cout << i << "\t"; } return os; };
/* ==================== DATA MEMBERS ======================================= */ protected: std::vector _ofthings;
private:
}; /* ----- end of template class Lvalue ----- */
};
int main ( int argc, char *argv[] ) {
std::vector test {0}; for(int i = 0; i<10; i++ ){ test[i] = i; std::cout << test[i] << "\t"; } std::cout << std::endl;
vect::Lvalue test2 {test}; for(int j=0, i = 10; i>0; i--, j++){ test[j] = i; std::cout << test[j] << "\t"; } std::cout << std::endl;
return EXIT_SUCCESS; } /* ---------- end of function main ---------- */
-- So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive http://www.coinhangout.com - coins! http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013 _______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
|
|