l*********s 发帖数: 5409 | 1 [question] what is the time complexity of qsort in standard c libarary(GCC,
more specifically)? Is is based on quick sort algorithm? |
|
l*********s 发帖数: 5409 | 2 Thank you! How about qsort in GCC? |
|
m********r 发帖数: 334 | 3 1)
#pragma pack(1)
typedef struct
{
unsigned int a:22;
unsigned int b:10;
unsigned int c:20;
unsigned char d:6;
unsigned char e:6;
unsigned int f:10;
unsigned char g:3;
unsigned char h:3;
} S1 ;
#pragma pack()
2)
typedef struct
{
unsigned int a:22;
unsigned int b:10;
unsigned int c:20;
unsigned char d:6;
unsigned char e:6;
unsigned int f:10;
unsigned char g:3;
unsigned char h:3;
} __attribute__ ((packed)) S2 ;
为什么sizeof(S1)=1... 阅读全帖 |
|
t****t 发帖数: 6806 | 4 you better have some compiler knowledge to understand the asm code. also ABI
knowledge might help.
and gcc uses at&t syntax, slightly different from intel syntax.
That |
|
d**d 发帖数: 389 | 5 $ g++ --version
g++ (GCC) 4.4.4 20100630 (Red Hat 4.4.4-10)
code 如下:
#include
using namespace std;
class Animal
{
protected:
string m_strName;
Animal(string strName):m_strName(strName)
{
};
public:
string GetName(){return m_strName;};
virtual const char* Speak(){return "???";};
};
class Cat:public Animal
{
public:
Cat(string strName): Animal(strName)
{
}
virtual const char *Speak(){return "Meow";};
};
clas... 阅读全帖 |
|
d**d 发帖数: 389 | 6 我的意思是说gcc查不出这类错误? 这个错误是明显的啊。为什么他能查出来
reference在初始化的时间没有赋值? |
|
X****r 发帖数: 3557 | 7 What error? "pAnimal = cDog;" is a perfectly legal C++
statement with well-defined semantics. If you expect this
statement to do something else, it's not gcc's problem. |
|
m*******l 发帖数: 12782 | 8 kao,
ubuntu 13.10自带gcc 4.8.1 |
|
n******t 发帖数: 4406 | 9 最近编过cross compiler 4.8.
你要trunk作甚,此外你不交叉编译这年头编译gcc作甚。 |
|
b*******s 发帖数: 5216 | 10 gcc官网有个infrastructure页面,都有下载 |
|
e****d 发帖数: 333 | 11 > export TSTVAR=64
gcc -DCLS=$(echo $TSTVAR) main.cpp
请问,这个 -DCLS是什么意思?
而且后面的地一个$是什么意思? 把echo命令执行结果当作 -DCLS的值? |
|
w***g 发帖数: 5958 | 12 -phtread是指让编译器在实现某些并行功能的时候产生使用pthread的代码,
隐含-lphtread. gcc似乎只有openmp依赖这个,并且-fopenmp隐含-pthread.
但是g++在编译某些C++并行功能的时候(比如std::async), 是否用
-pthread出来的效果是不一样的.我印象中如果不加-pthread,
std::launch::async是不起作用的,即使加了-lpthread也没用. |
|
g****t 发帖数: 31659 | 13 代码是一个tool。
里面有一个win com的第三方库,
可能是这个问题。
公司是赛门铁克监控带杀毒软件。
比较烦的是假如将来我发.exe给客户,还要
确认他不会出这个问题。所以想问问有没什么赛门铁克
认证之类的东西。
Hello world 的代码就没这问题。
Gcc是mingw 64
: 方便的话发一下代码,还有是哪个杀软
|
|
w***g 发帖数: 5958 | 14 windows底下用vc重新编译啊。
其实win底下最好的C++环境应该是win SDK + cmake,
很适合我们这样的老年人。
不需要IDE。之前IDE不免费,但SDK一直是免费的。
win下面用gcc啥的,政治不正确。 |
|
s********1 发帖数: 581 | 15 gcc 编译的时候要包括 header source file 吗?
main.c 的程序中引用了sub.h 和 sub.c 中定义的function pphh(),
***************************************************************
//File: main.c
#include
#include "sub.h"
void main()
{
pphh();
}
*************************************************
//File: sub.h
#ifndef _sub_h
#define _sub_h
void pphh();
#endif
************************************************
//File: sub.c
#include
#include "sub.h"
void pphh()
{
printf("pphh\n");
}
************************ |
|
s********1 发帖数: 581 | 16 gcc 编译的时候要包括 header source file 吗?
main.c 的程序中引用了sub.h 和 sub.c 中定义的function pphh(),
***************************************************************
//File: main.c
#include
#include "sub.h"
void main()
{
pphh();
}
*************************************************
//File: sub.h
#ifndef _sub_h
#define _sub_h
void pphh();
#endif
************************************************
//File: sub.c
#include
#include "sub.h"
void pphh()
{
printf("pphh\n");
}
************************ |
|
l***n 发帖数: 731 | 17 我的一个程序需要一个老的版本的gcc 3.3.2 编译?
作为一个普通用户,如何安装gcc3.3.2? 我不是超级用户。 |
|
p**v 发帖数: 853 | 18 ./configure --prefix=/path/to/local/ --exec=/path/to/local
you don't have to be root to compile gcc. |
|
l*l 发帖数: 225 | 19 If you are not root, so every thing is ok.
You only delete your own C source file which Makefile needed.
I Guess you use OSF/1 UNIX, so you have no pkgadd( Solaris unix comes from BSD)
Last time, I think you remove system's gcc package. Why ask admin add your
quota ? |
|
a***e 发帖数: 5 | 20 use struct stat to get inode of a file like this,
...
struct stat stab;
...
...
stat(filename,&stab)
...
gcc says error of "storage size of 'statb' isn't known"
but cc works well.
what's the point? |
|
m*******m 发帖数: 182 | 21 gcc checks more stuff and more strictly than cc.
This may be a scope problem of the code. |
|
m*******m 发帖数: 182 | 22 gcc checks more stuff and more strictly than cc.
This may be a scope problem of your code. |
|
l*****y 发帖数: 10 | 23 hi,
My question is about how to install gcc on unix.
after log in as root, where should i put the *.tar file?
where should i install it?
what's configuration? what's it for?
3x |
|
d**s 发帖数: 1 | 24 ./configure
Configuring for Apache, Version 1.3.24
+ Warning: Configuring Apache with default settings.
+ This is probably not what you really want.
+ Please read the README.configure and INSTALL files
+ first or at least run './configure --help' for
+ a compact summary of available options.
+ using installation path layout: Apache (config.layout)
Creating Makefile
Creating Configuration.apaci in src
Creating Makefile in src
+ configured for Solaris 280 platform
+ setting C compiler to gcc
+ set |
|
c*****t 发帖数: 1879 | 25 "as" is the assemblier. Some how either GCC could not find it
or it was not present on your computer. |
|
|
s****e 发帖数: 36 | 27 then write your code using multiple threads/processes...
it has nothing to do with gcc.. |
|
c*****t 发帖数: 1879 | 28 You can if you have huge amount of space. Do the following before
compilation:
configure --prefix="/your-home-directory"
replace stuff inside the quotes with your home directory. After
you run
make
and successfully compiled everything. Do
make install
That would install gcc/g++ to ~/bin, ~/info, ~/include, ~/lib, ~/man
and such for its appropriete files. |
|
t****r 发帖数: 76 | 29 我是拷来的一堆文件,不是安装版。所以当"gcc
mysource.c"的时候报错说找不到"stdlib.h"。
我在Win2k的环境变量$INCLUDE里加了也没用。
在别的地方也找不到设置,甚至连名字都不知道:(
请高手指点。怎么设置,设置哪里啊?
谢谢。 |
|
D**e 发帖数: 10169 | 30 do a gcc -v, it will tell you where the specs file is located. |
|
D**e 发帖数: 10169 | 31 cc 就可以. 好好看看GNU的INSTALLATION NOTE.
GCC |
|
a***g 发帖数: 3 | 32 GCC 和 G++ 的区别在什么地方?
以前版本的感觉两者没有什么区别,
但是最近在 LINUX 9 下面编译, 发现以下问题:
CODE 为:
__________________________________
FILENAME: t.cc
__________________________________
# include
# include
# include
int main () {
char *c;
c = new char [100];
if (!c)
printf ("Error allocation\n");
strcpy (c, "Hello World\n");
printf ("Hello! %s", c);
cout << "Hello" << c <
}
__________________________________
用 G++ 编译正确
______________________________ |
|
m**u 发帖数: 632 | 33 gcc可以编译了,但我一些C程序中用到几个C++的流,如ifstream就
找不到了,该怎么设置呢.原来在系里solaris上是可以的,现在用
自己的solaris就不知道该怎么办了
谢谢 |
|
p**s 发帖数: 788 | 34 went to freeware.sgi.com.
clicked on 'install' to directly install GGC on an O2.
all unzippd GCC related files were found under /usr/freeware/
now how do I do 'configure'?
I went to /usr/freeware/bin and type in ./configure and it didn't work.
thanks in advance. |
|
p******f 发帖数: 162 | 35
it seems you have installed a binary version, just try
to look for a gcc exetuable |
|
c******n 发帖数: 7 | 36 实验室刚买了SUNblade2000,自带操作系统solaris8,没有买任何软件,想在上面运行c++
,请问如何安装gcc? 有没有简易的方法,或者什么网页介绍的step by step 方法?
多谢! |
|
c******n 发帖数: 7 | 37 不知道两者区别在哪儿?不知道Solaris9 自带gcc,g++,和f77吗?
谢谢!
者有 |
|
wy 发帖数: 14511 | 38 ft, don't be so upset. Let me give you an example:
GCC doesn't really have a IR that optimization can be done
on it. Most other compilers do have such thing |
|
p****m 发帖数: 19 | 39 I downloaded gcc and gmake, but when I compile the program, it says "stdio.h |
|
c*****t 发帖数: 1879 | 40 gcc -I directory
As for the directory, you can check /usr/include, /usr/local/include
and see if the files you needed are there.
any |
|
c*****t 发帖数: 1879 | 41 You need to tell gcc the system include directory location. |
|
c*****t 发帖数: 1879 | 42 You need to tell gcc the system include directory location. |
|
s********1 发帖数: 581 | 43 gcc 编译的时候要包括 header source file 吗?
main.c 的程序中引用了sub.h 和 sub.c 中定义的function pphh(),
***************************************************************
//File: main.c
#include
#include "sub.h"
void main()
{
pphh();
}
*************************************************
//File: sub.h
#ifndef _sub_h
#define _sub_h
void pphh();
#endif
************************************************
//File: sub.c
#include
#include "sub.h"
void pphh()
{
printf("pphh\n");
}
************************ |
|
t****n 发帖数: 39 | 44 I don't think gcc has auto-parallelization implemented. |
|
a**a 发帖数: 416 | 45 gcc好像不是并行C编译器. 恐怕你得用线程编程, 才能充分利用双CPU. |
|
h*******y 发帖数: 1563 | 46 cygwin default installation 已经 include gcc了 |
|
a*****e 发帖数: 182 | 47 谢谢。那我可以用make命令吗?
那个库只说如何在gcc里用。
我对simulation是新手,请多指教! |
|
x******a 发帖数: 6336 | 48 I got thousands problems on the following piece of code "dumpfile.h" when I
compile under cygwin. it is ok under visual stduio... can anyone help?
Thanks!
#include
#include
#include //ostream_iterator
#include //cerr
#include //std::copy
template
void dump_to_file(const char* filename, const std::vector& v_d){
std::ofstream ofs(filename);
if(!ofs){
std::cerr<<"Unable to open the file to write!n";
return ;... 阅读全帖 |
|
a****a 发帖数: 5763 | 49 2011年12月3日,LLVM 3.0正式版发布,完整支持所有ISO C++标准和大部分C++ 0x的新
特性, 这对于一个短短几年的全新项目来说非常不易。
开发者的惊愕
在2011年WWDC(苹果全球开发者大会)的一场与Objective-C相关的讲座上,开发者的
人生观被颠覆了。
作为一个开发者,管理好自己程序所使用的内存是天经地义的事,好比人们在溜狗时必
须清理狗的排泄物一样(美国随处可见“Clean up after your dogs”的标志)。在本
科阶段上C语言的课程时,教授们会向学生反复强调:如果使用malloc函数申请了一块
内存,使用完后必须再使用free函数把申请的内存还给系统——如果不还,会造成“内
存泄漏”的结果。这对于Hello World可能还不算严重,但对于庞大的程序或是长时间
运行的服务器程序,泄内存是致命的。如果没记住,自己还清理了两次,造成的结果则
严重得多——直接导致程序崩溃。
Objective-C有类似malloc/free的对子,叫alloc/dealloc,这种原始的方式如同管理C
内存一样困难。所以Objective-C中的内存管理又增... 阅读全帖 |
|
a****a 发帖数: 5763 | 50 http://bbs.weiphone.com/read.php?tid=506463
Mac OS X 10.6即所谓的Snow Leopard操作系统已正式发售。一如既往,Apple产
品光鲜的外表下凝聚了太多艰辛的劳作。ArsTechnic的John Siracusa以其独特的、专
业的、全面的视角深入翔实地体验这款最新的操作系统。
Weiphone.com将对该综述进行翻译整理并独家连载。欢迎关注。
引用
译注:为了帮助您更加顺畅地理解本文的内容,这里补充了文中一些相关概念的背景资
料。
编译器(compiler):是一种能够将源代码(通常由高级别的程序语言编写而成)
转换为低级别机器语言的程序。源码转换最重要的一个目的在于创建可执行文件。详情
请参考wikipedia。
LLVM(Low Level Virtual Machine,低级虚拟机):是构架编译器(compiler)
的框架系统,以C++编写而成,用于优化以任意程序语言编写的程序的编译时间(
compile-time)、链接时间(link... 阅读全帖 |
|