gcc4

Why does sqrt() work fine on an int variable if it is not defined for an int?

大兔子大兔子 提交于 2021-02-10 12:19:40
问题 In chapter 3 of Programming: Principles and Practice using C++ (sixth printing), Stroustrup states (p.68): "Note that sqrt() is not defined for an int " . Here is a simple C++ program based on that chapter: #include "std_lib_facilities.h" int main() { int n = 3; cout << "Square root of n == " << sqrt(n) << "\n"; } Given the quote above, I would expect the process of compiling or running this program to fail in some way. To my surprise, compiling it (with g++ (GCC) 4.2.1) and running it

How to convince avr-gcc, that the memory position of a global byte array is a constant

大城市里の小女人 提交于 2020-01-05 09:14:25
问题 I writing a fast " 8 bit reverse "-routine for an avr-project with an ATmega2560 processor. I'm using GNU C (WinAVR 20100110) version 4.3.3 (avr) / compiled by GNU C version 3.4.5 (mingw-vista special r3), GMP version 4.2.3, MPFR version 2.4.1. First I created a global lookup-table of reversed bytes (size: 0x100): uint8_t BitReverseTable[] __attribute__((__progmem__, aligned(0x100))) = { 0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0, 0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0, [...] 0x1F,0x9F,0x5F

Why isn't the gcc 4.x.x series compilers installed by MinGW by default?

时光毁灭记忆、已成空白 提交于 2020-01-02 08:03:22
问题 Currently, MinGW's only installs the 3.x.x series of the gcc compiler by default. However, it looks like the 4.x.x series of compilers have been out for some time, and as others have mentioned, it seems to work just fine. Is there any reason why it hasn't moved to the 4.x.x versions yet, and any reason why I shouldn't use the newer versions of gcc? 回答1: GCC4's C++ ABI has changed from GCC3, and it includes a lot of new features (like its tree vectorization) that a lot of people still consider

Why isn't the gcc 4.x.x series compilers installed by MinGW by default?

戏子无情 提交于 2020-01-02 08:03:20
问题 Currently, MinGW's only installs the 3.x.x series of the gcc compiler by default. However, it looks like the 4.x.x series of compilers have been out for some time, and as others have mentioned, it seems to work just fine. Is there any reason why it hasn't moved to the 4.x.x versions yet, and any reason why I shouldn't use the newer versions of gcc? 回答1: GCC4's C++ ABI has changed from GCC3, and it includes a lot of new features (like its tree vectorization) that a lot of people still consider

How to set gcc 4.3 default specs file?

白昼怎懂夜的黑 提交于 2019-12-30 05:48:08
问题 When using gcc version 4.3.2, I see how to generate specs using: $ /usr/local/gcc-4.3.2/bin/gcc -v Using built-in specs Now changing to the same directory as libgcc: cd /usr/local/gcc-4.3.2/lib/gcc/x86_64-unknown-linux-gnu/4.3.2 /usr/local/gcc-4.3.2/bin/gcc -dumpspecs > specs I have a populated specs file that I can modify. However, once that is done I still see that: $ /usr/local/gcc-4.3.2/bin/gcc -v Using built-in specs How do I tell gcc to use that specs file by default rather than forcing

Cross-compile Autotools-based Libraries for Official iPhone SDK

本小妞迷上赌 提交于 2019-12-29 15:01:12
问题 Background I am writing a program that targets several different phones, including the iPhone. The program depends on several thirdparty libraries. I am having difficulty cross-compiling these thirdparty libraries for the iPhone and iPhone simulator. The libraries include the Apache Portable Runtime and GNUTLS, as well as their dependencies. I would like the built libraries to end up in the prefixes "/opt/iphone-3.1", "/opt/iphone-3.0", "/opt/iphone-2.2.1", "/opt/iphone-simulator-3.1", and "

Impact on upgrade gcc or binutils

情到浓时终转凉″ 提交于 2019-12-25 13:35:13
问题 I want to use Red Hat Enterprise Linux 5.8 to compile folly, and gcc is 4.1.2. But folly needs gcc >=4.6. So I need to upgrade gcc to 4.6, maybe binutils etc. If new toolchain generates binary files such as *.a *.so, would running them on old Red Hat Enterprise Linux 5.8 bring any problem or unstabitily? 回答1: Probably no big trouble (because GCC 4.1 & soon released GCC 4.8 produces compatible code), at least for C code. For C++ code I believe there is a incompatibility. Certainly the libstdc+

gcc 4.5 installation problem under ubuntu

匆匆过客 提交于 2019-12-21 18:07:58
问题 I tried to install gcc 4.5 on ubuntu 10.04 but failed. Here is a compile error that I don't know how to solve. Is there anyone successfully install the latest gcc on ubuntu? Following is my steps and the error message, I'd like to know where is the problem.... Step1: download these files: gcc-core-4.5.0.tar.gz gcc-g++-4.5.0.tar.gz gmp-4.3.2.tar.bz2 mpc-0.8.1.tar.gz mpfr-2.4.2.tar.gz Step2: Unzip above files Step3: move gmp, mpc, mpfr to the gcc-4.5.0/ directory. mv gmp-4.3.2 gcc-4.5.0/gmp mv

What is a lifetime of a function return value?

拥有回忆 提交于 2019-12-21 13:49:17
问题 I read about the return values between function calls, and experimented with the following code snippet : /* file structaddr.c */ #include <stdio.h> #define MSIZE 10 struct simple { char c_str[MSIZE]; }; struct simple xprint(void) { struct simple ret = { "Morning !" }; return ret; } int main(void) { printf("Good %s\n", xprint().c_str); return 0; } The code is compiled without errors and warnings . Tested with GCC 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1) and Visual C++ compilers . gcc -m32 -std=c99

What is wrong with this use of offsetof?

女生的网名这么多〃 提交于 2019-12-19 12:25:10
问题 I'm compiling some c++ code in MinGW GCC 4.4.0, and getting warnings with the following form... warning: invalid access to non-static data member '<membername>' of NULL object warning: (perhaps the 'offsetof' macro was used incorrectly) This problem seems familiar - something I've tried to resolve before and failed, I think, but a while ago. The code builds fine in Visual C++, but I haven't built this particular code recently in any other compiler. The problem code is the following template..