compiler-construction

How to run pthreads on windows

余生长醉 提交于 2020-12-23 02:44:59
问题 I used to use a mac to write some c programs but its not working now.. I have to use an old windows laptop for a while.. I installed codeblocks and tested a simple program using pthreads. Unfortunately it didnt work.. pthread_create(&thrd1, NULL, thread_execute, (void *)t); It keeps saying undefined reference to ' imp _pthread_create' how can i fix it and will i face similar problems writing these sort of programs? Thanks 回答1: You've clearly got a version of pthreads for Windows. You just

How to run pthreads on windows

巧了我就是萌 提交于 2020-12-23 02:42:19
问题 I used to use a mac to write some c programs but its not working now.. I have to use an old windows laptop for a while.. I installed codeblocks and tested a simple program using pthreads. Unfortunately it didnt work.. pthread_create(&thrd1, NULL, thread_execute, (void *)t); It keeps saying undefined reference to ' imp _pthread_create' how can i fix it and will i face similar problems writing these sort of programs? Thanks 回答1: You've clearly got a version of pthreads for Windows. You just

Generated ELF executable segfaults during startup

别说谁变了你拦得住时间么 提交于 2020-12-12 05:10:23
问题 I'm generating an ELF executable with a .text section loaded into a LOAD segment. It disassembles fine, but trying to run it under gdb gives During startup program terminated with signal SIGSEGV, Segmentation fault. readelf gives: ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry

What values are stored into Symbol table in compiler construction

99封情书 提交于 2020-12-12 02:51:50
问题 In Compiler Construction by Aho Ullman and Sethi, it is given that the input string of characters of the source are read by scanner(lexical analysis) and groups characters into meaningful sequences called lexems,and for each lexeme scanner produces output as a token of the form. like below <token-name, attribute-value> e.g position = initial + rate * 60 these characters are group grouped into lexemes and mapped into tokens like position is lexeme and mapped into token as <id, 1> where id is

What values are stored into Symbol table in compiler construction

允我心安 提交于 2020-12-12 02:51:08
问题 In Compiler Construction by Aho Ullman and Sethi, it is given that the input string of characters of the source are read by scanner(lexical analysis) and groups characters into meaningful sequences called lexems,and for each lexeme scanner produces output as a token of the form. like below <token-name, attribute-value> e.g position = initial + rate * 60 these characters are group grouped into lexemes and mapped into tokens like position is lexeme and mapped into token as <id, 1> where id is

Gcc compilation “cannot compute suffix of object files: cannot compile”

走远了吗. 提交于 2020-11-30 04:08:09
问题 I'm actually reading the LFS book (version 7.1) and I'm blocked at page 53. Trying to compile gcc, I tried the following command: ./configure --target=$LFS_TGT --prefix=$LFS/build/gcc-build --disable-nls\ --disable-shared --disable-multilib --disable-decimal-float --disable-threads\ --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath\ --disable-target-libiberty --disable-target-zlib\ --enable-languages=c\ --without-ppl --without-cloog\ --with-mpfr-include=$LFS/source

Where is the return object stored?

混江龙づ霸主 提交于 2020-11-28 04:52:54
问题 I generally understand how a function returns an object by value. But I wanted to understand it on the lower level. Assembly level if reasonable. I understand this this code ClassA fun(){ ClassA a; a.set(...); return a; } is transformed internally to void fun(Class& ret){ ClassA a; a.set(...); ret.ClassA::ClassA(a); } Which effectively call the copy constructor on the return value. I also understand that there are some optimizations (like NRVO) that could generate the following code avoiding

Where is the return object stored?

人走茶凉 提交于 2020-11-28 04:46:07
问题 I generally understand how a function returns an object by value. But I wanted to understand it on the lower level. Assembly level if reasonable. I understand this this code ClassA fun(){ ClassA a; a.set(...); return a; } is transformed internally to void fun(Class& ret){ ClassA a; a.set(...); ret.ClassA::ClassA(a); } Which effectively call the copy constructor on the return value. I also understand that there are some optimizations (like NRVO) that could generate the following code avoiding