Re: [Objc-discuss] Why Sementation fault?
Smalltalk 80 extensions for C programs
Brought to you by:
stes
From: David S. <st...@te...> - 2021-07-28 06:47:10
|
Hi, int i is of type 'int' , not 'id' (not an Objective-C Object). Basically the idea of the Computer Algebra Kit is to provide Objective-C objects for computer algebra and integer arithmetic, so you could do: [aCltn add:[BigInt int:i]]; or something like [aCltn add:[BigInt factorial:i]]; If I run the program, #include <stdio.h> #include <objpak.h> #include <cakit.h> int main(void) { id aCltn = [OrdCltn new]; int i = 0; for(i = 1; i < 100; i++) { [aCltn add:[BigInt int:i]]; } for(i=0;i<[aCltn size];i++) [[aCltn at:i] printLine]; return 0; } $ objc -o bigint bigint.m it works Regards, David Stes On Tue, Jul 27, 2021 at 12:25:20PM +0000, hung.nguyengia via Objc-discuss wrote: > It's objc on Linux. > > This code compiled: > > #include <stdio.h> > #include <objpak.h> > > int main(void) { > id aCltn = [OrdCltn new]; > int i = 0; > for(i = 1; i < 100; i++) { > [aCltn add:i]; > } > for(i=0;i<[aCltn size];i++) [[aCltn at:i] printLine]; > return 0; > } > > But when run will segmentation fault immediately. > > What did I do wrong? > > Sent with ProtonMail Secure Email. > > > _______________________________________________ > Objc-discuss mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objc-discuss |