I'm really new to programming (in general - it's pathetic) and some Python-related assembly has cropped up in this app that I'm hacking to run on 64-bit.
Essentially, the code goes like this:
#define FUNCTION(name) \
.globl _##name; \
_##name: \
jmp *(_p_##name)
.text
FUNCTION(name)
Th...
Is there a difference if I compile the following program using c89 vs c99? I get the same output. Is there really a difference between the two?
#include <stdio.h>
int main ()
{
// Print string to screen.
printf ("Hello World\n");
}
gcc -o helloworld -std=c99 helloworld.c
vs
gcc -o helloworld -std=c89 hellowor...
I have an application that only crashes in -O2 optimization (compiled with gcc 4.2.4). When I step through the code and get to the spot that crashes and try to inspect the value, I get a "value optimized out" in gdb.
I read on the internet that this means that the value is stored in the register. I was wondering if my crash could be r...
GCC gives me an "array type has incomplete element type"-error message when i try to compile this:
typedef struct _node node;
struct _node{
int foo;
node (*children)[2];
int bar;
};
In memory the struct should look like this
0x345345000000 foo
0x345345000004 pointer to 1. child node
0x345345000008 pointer to 2. child node
0x345345...
Do you know how strong VLIW architectures support exists in GCC compiler infrastructure? I know that there are some VLIW architectures supported by GCC. Looking at them, it seems that the pipeline optimizations are left to another optimization layer. Are there good (not GCC internals doc) materials on this?
...
Hi,
probably this is a stupid question, but I am desperate now and can not finf the answer. In OSX during C++ program compilation with G++ I use
LD_FLAGS= -Wl,-stack_size,0x100000000
but in suse linux I get constantly erros like:
x86_64-suse-linux/bin/ld: unrecognized option '--stack'
and similar.
I know that some options to cop...
I am wondering if there is a way to find out which g++ compiler/linker flags where used in creating a binary-only library.
For example there might be a 3rd party shared library (only .h/.so files are there).
So I think it would be a good idea to use the same g++ flags when compiling and linking my own application (that is using the bin...
I've written the below makefile:
hw2p1: hw2p1_main.o hw2p1_getit.o hw2p1_parseit.o hw2p1_moveit.o hw2p1_showit.o
gcc hw2p1_main.o hw2p1_getit.o hw2p1_parseit.o hw2p1_moveit.o hw2p1_showit.o
hw2p1_main.o: hw2p1_main.c
gcc -c hw2p1_main.c
hw2p1_getit.o: hw2p1_getit.c
gcc -c hw2p1_getit.c
hw2p1_parseit.o: hw2p1_parseit.c
gc...
I noticed that when I make my application with gcc and look at the output during the linking phase, I see the following lib included twice:
/home/rb01/opt/trx-HEAD/gcc/4.2.4/lib/../lib64/libstdc++.so
And so I was just wondering if this is a problem with g++ (gcc) or if the second one is simply ignored?
Thanks!
...
GCC has the ability to make a symbol link weakly via __attribute__((weak)). I want to use the a weak symbol in a static library that users can override in their application. A GCC style weak symbol would let me do that, but I don't know if it can be done with visual studio.
Does Visual Studio offer a similar feature?
...
I am trying to install a C++ compiler on Eclipse without altering the Path variables as I can't, the machine has limited rights. Eclipse obviously runs fine, it's the build that doesn't, it complains about.
The first thing I noticed was a warning that said "Unresolved inclusion" for the libary file stdio.h
I added the path variable in...
It seems that Cocoa seems to be the main platform for Objective-C. GCC (which Xcode uses) supports Objective-C so it must be available on a wide range of platforms.
Are there any notable cross-platform projects that use Objective-C but not Cocoa (or its open source cousin GNUStep)? Is it really used outside the Apple ecosystem?
...
If I have the following C++ code to compare two 128-bit unsigned integers, with inline amd-64 asm:
struct uint128_t {
uint64_t lo, hi;
};
inline bool operator< (const uint128_t &a, const uint128_t &b)
{
uint64_t temp;
bool result;
__asm__(
"cmpq %3, %2;"
"sbbq %4, %1;"
"setc %0;"
: // outp...
Here's a simple example:
#include <stdlib.h>
int main(void) {
_set_error_mode(_OUT_TO_STDERR);
return EXIT_SUCCESS;
}
When compiling this program, I get the following problems:
main.c: In function 'main':
main.c:4: error: implicit declaration of function '_set_error_mode'
main.c:4: error: '_OUT_TO_STDERR' undeclared (first u...
Hi,
If any, what are the (obviously ignored by GCC) comments below called?
How do I get rid of them?
Here:
eisbaw@leno:~/GCC$ cpp < /dev/null
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
eisbaw@leno:~/GCC$
...
How can I compile the GCC Compiler so that I can pull the entire thing over to another system and use the program? I don't mind pulling in other files as well, but is there a way to gather all the required system libs as well? The OS and Arch will remain constant across the different systems, but one may contain Slackware where the other...
Hello,
I need to open a file as std::fstream (or actually any other std::ostream) when file name is "Unicode" file name.
Under MSVC I have non-standard extension std::fstream::open(wchar_t const *,...)? What can I do with other compilers like GCC (most important) and probably Borland compiler.
I know that CRTL provides _wfopen but it ...
Here's a simple C file:
#include <stdio.h>
#include <stdlib.h>
int
main() {
printf("hi there!\n");
return 0;
}
Compiling with gcc -ansi -pedantic -pedantic-errors gives this:
In file included from /usr/include/i386/_structs.h:38,
from /usr/include/machine/_structs.h:31,
from /usr/include/sys/_struct...
This actually bugging me from quite sometime now.The question is like this : How to set the the exit status of a program to any value without explicitly using return/exit in gcc/g++ ?
Let us consider this piece of code : (Takes input from stdin and print
it to the stdout until a zero input 0 is encountered)
#include <stdio.h>
int main(...
#include <libnotify/notify.h>
#include <glib.h>
#include <unistd.h>
int main(int argc, char** argv)
{
if(argc == 3)
{
NotifyNotification *n;
notify_init("Test");
n = notify_notification_new (argv[1],argv[2], NULL, NULL);
notify_notification_set_timeout (n, 3000); //3 seconds
if (!notify_not...