MESSAGE
DATE | 2016-11-29 |
FROM | nylxs
|
SUBJECT | Subject: [Learn] Look at this exciting output by my test program
|
From learn-bounces-at-nylxs.com Tue Nov 29 16:54:16 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 63C37161313; Tue, 29 Nov 2016 16:54:16 -0500 (EST) X-Original-To: learn-at-nylxs.com Delivered-To: learn-at-nylxs.com Received: from mta2.srv.hcvlny.cv.net (mta2.srv.hcvlny.cv.net [167.206.4.197]) by mrbrklyn.com (Postfix) with ESMTP id 96CB5160E77 for ; Tue, 29 Nov 2016 00:52:28 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=optonline.net; s=dkim-001; t=1480398747; bh=4+/vOvZ8+d/qQtBFJ7mnGyM/WWhy/REvqIaz37XKs4E=; h=To:From:Subject:Message-ID:Date; b=h3dt9Qmp5JoKf2bs/8Q4WqCqAD6FBuuDOH1tcFnUHYoJ+Fyo9adVnkeU7MUPHb6pF WKCVpUYsOqolHm+TazOnxjnoc2jji+yJ0w3XsTRIZFMeL9xOzWZAcWCpJMk+1XmtIK 6O02E6XegcgX2updUytdEH4njt2fLHerxIKjOuN09YIQMFObzSg9flbo4ylo4y3VI6 HFxNjD2ugDenicvi9C5kUrJEHujVKoMu/DGgg5DR4QZdkDgX7I5++f5i8kCvccHnTz WjntNF5AFwNzto8lfWtg4jTROqF+Q9nKez6WTUorfHaBfdiOVH/XTETZb4PtKCKCcJ uGF+FWi9d2R+w== Authentication-Results: mta2.srv.hcvlny.cv.net smtp.user=mrbrklyn; auth=pass (LOGIN) X-Content-Analysis: v=2.1 cv=IdB6Ijea c=1 sm=1 tr=0 a=dOhXy1r7xzSwKFzJ68PqjA==:117 a=dOhXy1r7xzSwKFzJ68PqjA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IkcTkHD0fZMA:10 a=fsXLkTk5AAAA:8 a=mJzHDIt6c2xZe0J4g38A:9 a=QEXdDO2ut3YA:10 a=zTVZ3laHAWFKilA0fLUg:22 Received: from [96.57.23.82] ([96.57.23.82:47270] helo=[10.0.0.62]) by mta2.srv.hcvlny.cv.net (envelope-from ) (ecelerity 3.6.9.48312 r(Core:3.6.9.0)) with ESMTPA id EB/EB-10233-B971D385; Tue, 29 Nov 2016 00:52:27 -0500 To: Hangout , learn-at-nylxs.com From: nylxs Message-ID: Date: Tue, 29 Nov 2016 00:52:27 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 29 Nov 2016 16:54:14 -0500 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 ---------- */
_______________________________________________ Learn mailing list Learn-at-nylxs.com http://lists.mrbrklyn.com/mailman/listinfo/learn
|
|