I have a PS3 that I've installed YDL 6.1 and SDK 3.1 on and everything seems to be working fine, as I can compile and run the examples. However, I've run into some problems with writing programs of my own. I've created a small test case that seems to pinpoint the cause of the failure. I have the following code:
// mathtest.c
#include <s...
I need to write a templated function replace_all in C++ which will take a string, wstring, glibmm::ustring etc. and replace all occurrences of search in subject with replace.
replace_all.cc
template < class T >
T replace_all(
T const &search,
T const &replace,
T const &subject
) {
T result;
type...
Hi,
I am currently porting a project with a few hundred code files and dependencies onto several third-party libraries to Mac Os. I've finally gotten to the point where the program compiles without warnings or errors, but it does not seem to execute my own main function.
Instead it seems to execute some other main function which seems...
Is it possible to create macros to replace all forms of operator new with overloads that include additional args...say __FILE__ and __LINE__?
The trouble appears to be that operator new can either be coded with or without parentheses, therefore:
object-like macros:
#define new new(__FILE__, __LINE__)
will replace declarations like:...
I need to profile a program to see whether any changes need to be made regarding performance. I suspect there is a need, but measuring first is the way to go. This is not that program, but it illustrates the problem I'm having:
#include <stdio.h>
int main (int argc, char** argv)
{
FILE* fp = fopen ("trivial.c", "r");
if (fp)
{
...
Hello all,
on linux, gcc 4.3, compiling a class with boost::thread implementation and mutexes / condition variables I get the following strange error, apparently due to type conflicts with the posix thread library:
*Compiling: filter.cpp
/usr/include/boost/thread/condition.hpp: In member function »void boost::condition::wait(L&) [with ...
I am new to assembly language. It seems that gcc doesn't have _bittestandset function in intrin.h like MSVC does, so I implemented a new one. This one works fine in linux, but it goes wrong with mingw in winVista machine, the code is:
inline unsigned char _bittestandset(unsigned long * a, unsigned long b)
{
__asm__ ( "bts %1, %[b]"
...
I would like to pass a pointer (I am putting a file with data in memory with mmap) to processes spawned using fork + exec, but I am stuck on how to pass a pointer to the exec() spawned process?
UPDATE1:
Thanks for your inputs, I do use shared memory creating it with mmap with MAP_INHERIT flag:
Each mapped file and shared memory region...
I've added a toolchain to a plugin for Eclipse 3.4.1/CDT 5.0.1. Basically, the way it's
meant to work is, when I do a full build, we get
my_compiler -c foo.c
gcc -o foo foo.o
And, when I do a build from Project|Build All, that's what I get.
If I invoked the build programatically, I get
my_compiler -c foo.c
gcc -o foo.o
That's rig...
What is the earliest GNU GCC (g++) version to support the TR1 extern templates? For example, is it already supported in version 4.0?
...
I wrote the following code in AT&T Assembler Syntax for gcc
.global main
.section .data
to_gen_inner: #x f, implicit n
pushl %ebp
movl %esp, %ebp
movl $0xFF00FF00, %eax
call printregs
lret
.set to_gen_inner_len, . - to_gen_inner
.section .text
main:
pushl %ebp
movl %esp, %ebp
...
Consider the following:
volatile uint32_t i;
How do I know if gcc did or did not treat i as volatile? It would be declared as such because no nearby code is going to modify it, and modification of it is likely due to some interrupt.
I am not the world's worst assembly programmer, but I play one on TV. Can someone help me to understan...
When we are compiling a C program the output is stored in a.out. How can we redirect the compiled output to another file?
...
Is there a site that provides a great list of common C++ optimization practices?
What I mean by optimization is that you have to modify the source code to be able to run a program faster, not changing the compiler settings.
...
What is the difference between these two file types. I see that my C++ app links against both types during the construction of the executable.
How to build .a files? links, references, and especially examples, are highly appreciated.
...
I see this flag a lot in the makefiles.
What does it mean? and when should it be used?
...
For some long errors, the gcc output is dense and has lots of line-wrapping etc. Especially when errors are subtle, it can take me 10-30 seconds of squinting to parse it with my eyes.
I've taken to pasting this in an open code-editor window to get some basic syntax highlighting and enable reformatting with regex's.
Has anyone invented...
While compiling this morning I had a thgought.
Given a dedicated Linux machine (running Fedora for example), users remotely log in and compile (using gcc) their c++ software, which is stored on their own machines (on a small LAN), linked with symbolic links, to the Linux box.
Assume that each user is compiling exaclty the same code fo...
I'm writing a Linux kernel module in which I would like to have some code and associated data in the same section. I declare the data and the functions with the attribute tags, like:
void * foo __attribute__ ((section ("SEC_A"))) = NULL;
void bar(void) __attribute__ ((section("SEC_A")));
However when I do this, gcc complains with:
e...
Hello,
I have a question regarding gcc. Why I get an error of unused variable when I define the variable locally in a function but not when the variable is global in a unique file?.
I can understand that it can be use for someone else, but to do that then I need to put the external word right?
Thanks in advance.
...