Programming :: Disable Structure Alignment Using Gcc Compiler Options?
Jan 25, 2010
How can I disable structure alignment feature of gcc using command-line options ?I recently migrated to 64-bit OS, and doubt that I might be experiencing a structure alignment problem due to the new 64-bit architecture.I checked the sizes of the same C-style struct in both x86 and x86_64, and found out that they appear to be different by 20 bytes.I am not sure if this is due to structure alignment or the differences in data type lengths between two platforms.Hence, I will first disable the structure alignment feature, and then check the struct sizes again.
View 3 Replies
ADVERTISEMENT
May 30, 2011
I am comiling some programs on Linux using gcc previously compiled using cc compiler on Solaris. Below are some of the confusions:
1. There is -xildoff option in cc which is giving error "language ildoff not recognized". xildoff in cc is for switching off the option of incremental editor ild. Is there anything equivalent on gcc?
2. There is runtime link option in cc as -R but gcc just says "unrecognised option". Does gcc only supports LD_RUN_PATH?
3. There is -Xa option to force cc to chose a particular flavor of c.Its for default c and K&R C. gcc has -std option but not sure which one is equivalent to -Xa in c. It seems -std=c90?
View 2 Replies
View Related
Oct 17, 2010
I want to change the alignment of GtkTreeView widget(Right-to-Left algin) i.e add columns to the rifgt of GtkTreeView and change the title of the column and its content to the rifgt of the column but I do not know how to do it
View 1 Replies
View Related
Oct 11, 2010
We have a big proprietary project. Our code was compiling very properly with gcc 3.3.4 but not with 4.1.2.
The errors what we get is "ISO forbids declaration" / undefined symbols kind of.
my question is that is there any gcc/g++ compiler switch which can disable checking extra ISO confirmations and stick to our older ISO standards.
in addition to this how we can figure out what ISO standards are supported by which gcc/g++ versions
View 2 Replies
View Related
May 8, 2010
I was looking for a way to disable the Suspend and Hibernate options from the logout menu as my laptop hangs on both and requires unplugging/battery removal to restart.
I found a few pages with instructions for older Ubuntu versions but I didn't come across anything that applied directly to 10.04 Lucid Lynx so I thought I'd post what I found worked for me on 10.04.
Open a Terminal from the Applications>Accessories>Terminal. Because the file you will be editing requires root privileges to edit, you will need to use the sudo command:
Code:
sudo gedit /usr/share/polkit-1/actions/org.freedesktop.upower.policy
Enter your password. This will then open the settings file in the text editor with the needed permissions (opening the file directly with the editor you will get an error message if you try to save the file). There are two sections in this file, the first for suspend and the second for hibernate. Near the end of each section will be a line with:
Code:
<allow_active>yes</allow_active>
Change this from Yes to No to disable. Save the changes and reboot.
Code:
<allow_active>no</allow_active>
Now the power menu will not display these options. To reverse changes just repeat the above and change from no back to yes.
View 6 Replies
View Related
Mar 7, 2010
How do you malloc a struct in C? I have a structure of the form:
Code:
typedef struct child_req_to_parent
{
[code]...
View 5 Replies
View Related
Nov 20, 2009
I have a struct (small instance so not using code brackets )
struct random {
int a;
int b;
}example;
What i am trying is
example={0,0};
and it gives an error how to initialize all the entries within a struct to zero? In the above example i have used integers but what if they are some other data structure for example another structure?
View 2 Replies
View Related
Nov 2, 2010
I am learning Kernel Programming these days I came across a structure
Code:
static DEFINE_PCI_DEVICE_TABLE(rtl8139_pci_tbl) = {
{0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
{0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 },
[Code]...
View 5 Replies
View Related
Sep 22, 2010
I have started learning C and am following Ivor Horton's "Beginning C - From Novice to Professional". I've noticed that in the book the structure of the main function is:
int main (void) however on the internet I found a lot of cases: void main (void)Which one is preferred and why?
View 5 Replies
View Related
Jan 30, 2010
I want to disable Reboot and Shutdown options from the drop down menu in Ubuntu 9.10. I tried this:[URL] I also tried to modify the gdm.conf file, but the changes I made, made no difference.
View 2 Replies
View Related
May 3, 2011
I am using Ubuntu 10.04. I want to disable the cut, copy, paste options in the Edit menu when my system is connected by rdesktop. I want to make a write/copy protected session in the rdesktop. I have disabled the keybord shortcuts like Ctrl+X ,Ctrl+V, Ctrl+C by disabling their Keysyms in the rdesktop code. Now I need to disable the options in the edit menu.
View 3 Replies
View Related
Dec 13, 2010
I am implementing c program to access ext3 file system's metadata. I want to know how to access members of the in-memory superblock structure. I am able access on-disk ext3_super_block structure but dont know how to access in- memory structure and its members.
View 1 Replies
View Related
Oct 1, 2010
I have a mxn matric (which is my simplified way of saying it is RAM with bytes on it) Some of the locations on this metric is filled with some data and some places are empty. The mxn are very big numbers in size. I am trying to make a program so that if a system call wants to write some thing on empty locations on this mxn metric it should be able to do so without any problem. The thing which I want to understand or logic of a data structure is what data structure do you people feel should I be maintaining so that I can allocate the requested space immediately from the above mxn matric when some system call requests for some (k) number of locations from above metrics.
The logic initially I thought was to maintain a hashtable
1bytes requested----------> location 1,location 2,location 3.........location n
2bytes requested----------> location 1,location 2,location 3.........location n
3bytes requested----------> location 1,location 2,location 3.........location n
[code]....
but the problem with above logic is size of the pointers where I will be writing this problem is unsigned 64 byte.So to know location of one free byte if I am maintaining one pointer of type u64 this is not a feasible solution.
View 6 Replies
View Related
Oct 27, 2010
I wanted to implement a graph.By graph I mean to say that I am writing programs for BFS,DFS and other such stuff and want to see them in action. For this I started writing a program.The first entry point is to define a graph. I took a pen and paper and made a graph. Now to be able to code this in C.I defined a structure but I am finding problem in defining this structure. I looked into Google and came across incidence list and adjacency list representation [URL] after understanding that I am not able to understand how do I define my structure that would be a node in graph. Here is what my graph looks like
Quote:
|-----------31
| |
| 2---4---6---8
| |
[code]....
View 3 Replies
View Related
Aug 9, 2010
I am currently writing a program using raw sockets. This program is used to send out ARP reply frames. The problem that I have is that I do not seem to be able to fill out a structure that is pointing to part of a character array.
Code:
struct eth_header *eth;
struct arp_header *arp;
char buf[8];
eth = (struct eth_header *)buf;
arp = (struct arp_header *)(buf+sizeof(struct arp_header));
Whilst I can fill out the variables of eth, I cannot fill out the variables of arp. If I fill them out and then send the contents of the array using send to, only the first structure (the ethernet header) is sent out. The rest of the data appears to be the original junk data in the array. I have checked the address of the structure pointer and it is pointing to the right place in the array. If I write a raw sockets program that uses an IP header struct and TCP header struct I can point these into the array and write to both of them without any issues.
The difference here is that the call to socket is different:
Code:
/* For ethernet */
fd = socket(AF_INET, SOCK_PACKET, htons(ETH_P_ARP));
/* For IP */
fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
If I just create one structure containing all of the variables needed this gets around the issue, however, I would like to know what I am doing wrong in the first instance.
View 7 Replies
View Related
Sep 11, 2010
How can I disable Options +FollowSymlinks in .htaccess files on an Apache web server?
View 3 Replies
View Related
Dec 16, 2010
I have added new member "i_mymember" to inode on-disk structure in ext3_fs.h file and tried to access this in userspace program, but gives me error that "error: �struct ext3_inode� has no member named �i_mymember� "
I have compiled my kernel source code.
why this error is coming ...?
View 1 Replies
View Related
Nov 15, 2010
Options:A double linked list with fixed size character arrays. New nodes will be added when previous ones get filled. Dynamic arrays using realloc(). Linked list has the disadvantage of not having an O(1) search like an array but I think using realloc() will be more dangerous since it moves the whole block to a new location and if the new location is not big enough to hold the whole block, realloc fails !! this case will not occur with the linked list since its nodes are scattered.
View 14 Replies
View Related
May 25, 2009
I am writting a program that reads a text file (music.txt) & stores it in a Data Structure. I am a novice learning over the internet so I this is something I have never done. How do I do this?
Quote:
Write a program that reads the data from the music.txt file and store it in a data structure. To implement this data structure you must use an array of songs and each song must be represented by a struct with appropriate fields. So far all I can do is open to file to read it (very simple I know) but so far is it correct?
Code:
#include <iostream>
#include <fstream>
#include <strstream>
[code]....
View 3 Replies
View Related
Jul 30, 2010
I'm using ubuntu9.10 (x86_64) and have some code,
Code:
void show_utmp(struct utmp* ent)
{
time_t tmp;
if (ent->ut_type != USER_PROCESS)
return;
[Code]....
View 8 Replies
View Related
Jan 29, 2011
telling the exact macro name and location, by which I can gain control over the following kernel base level structure
1. strct super_block of Virtual File System, for super block object.
2. strct inode for inode ofject of VFS.
3 file structure for file object of VFS.
in addition to these if you know location to access other kernel structure.Please let me know.My main objective is to get the access to the structure pointer of these structure by which i can have access over the individual fields o these structure.
View 11 Replies
View Related
May 18, 2011
I'm having problems with compiling recursive Makefiles in my directory structure:
My folder layout is:
top/|- one/|- one.c (With main function)|- zero.c|- two/|- two.cin my top folder the make file looks like:
Code:
MAKE_DIRECTORIES = one two
.PHONY: all
all: $(MAKE_DIRECTORIES)
.PHONY: $(MAKE_DIRECTORIES)
$(MAKE_DIRECTORIES):
@echo $@
$(MAKE) --directory=$@
in my one and two folder I have the following Makefile:
Code:
.PHONE: all
all:
@echo $@
$(CC) $(CFLAGS) *.c
But when I compile it from top folder: make
I get following output:
Code:
one
two
Which states that directory statement by echo in main Makefile is ok but the files are not compiled in one and two.
View 5 Replies
View Related
Jun 15, 2011
I am trying to create a simple bash script to rsync some folders within a directory stucture. I am using wild cards, in the rsync source directory structure, but my command always fails. I believe it is the way I am using wild cards within my for loop. Here is my command ;
Code:
for seq in `cat test.txt` ; do rsync -nvP /folder/folder/folder/folder/folder/**/$seq /folder/folder/folder/ ; done This always fails, where if I do a ls to the destination, to test the path, it always works.
View 5 Replies
View Related
Jul 13, 2011
I installed Fedora on my machine. I'm very new at Linux but would like to start coding in C++. I would like to know the steps to write and compile a Hello World program using C++ in Linux. (I've been a Microsoft person all my life).
View 4 Replies
View Related
Jun 8, 2010
I am trying to learn C Programing and I'm having trouble on the output of my script. my script should count the characters in input but it doesn't give me any numbers..
here's my program code:
Code:
#include <stdio.h>
main()
{
double nc;
[code]....
View 14 Replies
View Related
Sep 7, 2010
Has any one ever come across a book on Linux programming which explains a Library structure in depth?
View 3 Replies
View Related
Jul 9, 2011
[Code]....
if the address of stWndClass is 403000h, WHY it would be compile as mov eax,[esi+403004] and the first one would be mov eax,[esi+4]? I know how to get the values 403004h and 4,but do not know why.
View 5 Replies
View Related
Mar 20, 2009
I want to read an ftp site [URL]...and download the sub-directory structure and ONLY the tagfiles to the local directory.
FROM THIS:
Code:
slackware
+--a
| |aaa_base-12.2.0-noarch-1.tgz
| |aaa_base-12.2.0-noarch-1.tgz.asc
[code]....
I tried wget + grep but that didn't work too well.
View 2 Replies
View Related
Apr 2, 2010
Does anyone know of a C Language Data Structure Tutorial? I have not been able to find anything much to speak of myself.
View 4 Replies
View Related
May 15, 2009
Is it possible to create a text based menu layout in bash were it is possible to browse through. The menu list should look something like this:
----------------------------------------
user: root
colour: blue
number: 4
animal: dog
----------------------------------------
At the start the cursor should blink at the r from root so that text can be entered. When pressing the enter the cursor should go to the b from blue and so on. the imported thing is that all the text is visible also beyond the position from the cursor.
View 4 Replies
View Related