Hello,
auto a = (Foo<T>*)malloc(sizeof(Foo<T>));
auto *b = (Foo<T>*)malloc(sizeof(Foo<T>));
I don't think it's important that templates are there, but the question is: are a and b of the same type?
g++ -std=c++0x -Wall (4.4) doesn't give any errors or warnings, but I haven't run the program so I don't know if it does the same thing.
...
Since Objective-C exists and is supported even in MinGW, by passing -x objective-c, is there a hack to achieve this with Android SDK? I've did a rudimentary test on a colleague's machine where it appears that language objective-cis not supported.
I am not interested in getting UIKit or AppKit, or even Foundation, to work; I've written m...
When I ran this code using gcc,
$ cat eatup.c
#include<stdio.h>
#include<stdlib.h>
int main() {
int i = 0;
while(1) {
i++;
}
}
$
the CPU graph went like this :
I am not sure why there is a cross in the CPU core usage.
I started the run at the rise to the left of the 40 mark, then initially core2 usage rose to...
hello
Is there option (or some utility) to generate graph of dependencies for given file? I am trying to track down who brings an include file into compilation unit.
...
I need to compile a 32-bit distribution of PyEphem. It does not seem like this should be difficult, however, I'm running into some compiler issues.
$ CFLAGS=-m32 python setup.py bdist -p i386
running bdist
running bdist_dumb
running build
running build_py
running build_ext
building 'ephem._libastro' extension
gcc -pthread -fno-strict-al...
What's Clang's equivalent to #pragma message as used in GCC and MSVC?
...
We are writing an application that compiles with both gcc and Visual C++. Some team members only use Visual C++/Windows, and others only use gcc/linux. Due to differences between compilers the build sometimes breaks. I have "fixed" several scenarios that lead to build breaks using compiler options to enable/disable warnings, but currentl...
I'm attempting to build a program (Dwarf Fortress) that uses C++0x features that aren't well supported in the latest Leopard version of XCode. As there is also a significant speed boost from using GCC 4.5, we've decided to build our own.
However, this causes the resulting executables to not work on Tiger, citing missing symbols in libc....
unsigned char ascii;
int a = 0;
char string[4] = "foo"; "A1"
ascii = (string[a] - 'A' + 10) * 16;
warning: conversion to ‘unsigned char’
from ‘int’ may alter its value
It seems that gcc considers chars and number literals as int by default. I know I could just cast the expression to (unsigned char) but how can I specify char lite...
In GCC compiler, whenever -O3 is flagged, the compiler optimizes mainly by Loop Unrolling and Function Inlining.
However, when I compiled an application that has the following function, it didn't do Function Inlining. From gprofing and gconving I could notice that this function (comp_t_delay) was not called from the main function unit o...
When I try to build the following program:
#include <stdio.h>
int main(void)
{
printf("hello world\n");
return 0;
}
On OS X 10.6.4, with the following flags:
gcc -static -o blah blah.c
It returns this:
ld: library not found for -lcrt0.o
collect2: ld returned 1 exit status
Has anyone else encountered this, or is it something...
Consider the following code:
#include <stdio.h>
#include <ctype.h>
char* Mstrupr(char* szCad);
int main()
{
char szCadena[] = "This string should print well.";
printf("%s\n", Mstrupr(szCadena));
printf("%s\n", Mstrupr("This string should fail."));
return 0;
}
char* Mstrupr(char* szCad)
{
int i;
for (i=0; szC...
I tried compiling ADPACK, written in C, on an Intel Mac running OX 10.6.4. I got the following error from the make command.
gcc -I/usr/local/include -I/home/ozaki/include -c adpack.c
adpack.c: In function ‘main’:
adpack.c:223: warning: incompatible implicit declaration of built-in function ‘strlen’
gcc -I/usr/local/include -I/home/ozaki...
I'm writing some code which stores some data structures in a special named binary section. These are all instances of the same struct which are scattered across many C files and are not within scope of each other. By placing them all in the named section I can iterate over all of them.
In GCC, I use _attribute_((section(...)) plus some ...
When I look at the help output from gar -h, it tells me:
[...]
gar: supported targets: elf64-x86-64 elf32-i386 a.out-i386-linux [...]
How can I instruct gar to create an elf32-i386 output?
...
plugin1.cpp:
#include <iostream>
static class TestStatic {
public:
TestStatic() {
std::cout << "TestStatic create" << std::endl;
}
~TestStatic() {
std::cout << "TestStatic destroy" << std::endl;
}
} test_static;
host.cpp
#include <dlfcn.h>
#include <iostream>
int main(int argc,char argv*[]) {
void* handle = dlop...
Hi Guys,
I have a ARM NEON Cortex-A8 based processor target. I was optimizing my code by making use of NEON. But when I compile my code I get this strange error. Don't know how to fix this.
I'm trying to compile the following code (PART 1) using Code Sourcery (PART2) on my host.
And I get this strange error (PART3). Am I doing somethi...
I have a static member in my class. It's declared and defined:
In my header:
class Bla {
...
static Bla* instance;
...
};
In my implementation file:
Bla::Bla* instance = 0;
But ld doesn't seems to like it:
release/bla.o:bla.cpp:(.text+0x19f7): undefined reference to `Bla::instance'
I'm using GCC 4.4.0 from the Qt SDK.
I can't ...
In Linux, readline() in an infinite loop repeatdly reads text\n. However, as soon as child processes start printing to the screen, readline no longer reads new lines. Even if I repeatdly press enter, readline() doesn't return.
Anyone know what's wrong?
Code sample as requested:
char* input;
int cpid;
while(1)
{
input = readline("...
I am new with using gcc and so I have a couple of questions.
What do the following switches accomplish:
gcc -v -lm -lfftw3 code.c
I know that lfftw3 is an .h file used with code.c but why is it part of the command?
I couldn't find out what -lm does in my search. What does it do?
I think I found out -v causes gcc to display program...