An unsigned number is never going to be less than zero, making this an infinite loop. Some compilers will warn you about this.
That said, this code looks suspect in a number of ways. Why are you using strings as the input and vector as the output -- why not vector or string for both? Why return giant vectors since it means it'll be copying them again and again and again and again and again? Pass one in as a reference.
Above all, why use boost? You will be chained to that depleted uranium lawn gnome forever. There's plenty of ways to initialize a map.
Or don't even use a map at all:
Vectors and maps have made this problem more difficult, not less.
Last edited by Corona688; 10-28-2014 at 02:49 PM..
When run it, segment fault.
What is wrong?
#include <stdio.h>
#include <stdlib.h>
const int max =20;
//****************************************************
// Input Matrix
//****************************************************
void inMatrixAA(int *AA, int row, int col)... (9 Replies)
Dear all,
I used debugger from C++ and these are the message I got:
Program received signal SIGSEGV, Segmentation fault.
0x00323fc0 in free () from /lib/tls/libc.so.6
(gdb) info s
#0 0x00323fc0 in free () from /lib/tls/libc.so.6
#1 0x00794fa1 in operator delete () from... (5 Replies)
Hi
some help read............
I'm getting a segmentation fault when I run an AIX COBOL/Db2 program.
I initiate the program from the command line, but it hangs, and then when I press enter it generates a segmantation fault and produces a core dump.
The box is running AIX software level ... (5 Replies)
Hi all
In the ltp-posix test,there is a case in open_posix_testsuite\conformance\interfaces\timer_gettime\speculative/6-1.c
I run the above code,it will has a segment fault, if I modify it to below,it works well
Anybody can tell me why? (1 Reply)
I´m writing this program in QNX , I`m kinda new to UNIX and programing in general, and when I try to run it it gives me the Memory Fault error. Can anyone help?
#include <stdio.h>
#include <fcntl.h>
void main(void)
{int a,ter;
char buf;
printf("a=");
scanf("%d",a);
ter=open... (6 Replies)
Hi,
Whether the following piece of code is placed in the read-only memory of code (text) segment or data segment?
char *a = "Hello";
I am getting two different answers while searching in google :( that's why the confusion is (7 Replies)
I always get segment fault, why? can sb help me and modify it, I have spend on much time on
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <string.h>
#define MAX 10
pthread_t thread;
void *thread1()
{
int *a;
int i, n;
... (1 Reply)
Hello everybody,
I've been working on a program on my Linux box, after finished the code, i compile it with gcc -Wall option, so i can see what's wrong or unused.
The Walll output shows nothing, so there are no loose ends on the program.
I run the program on my system, and it works PERFECTLY.... (5 Replies)
Hi
I have struggling a week to fix a program , in the begining i got SIGBUS , but after many attempts still the program gets SIGSEGV segment fault , In bellow i post the seg fault log + source codes. would really appreciate if experts help me to fix this segment fault error. any advice is... (2 Replies)
Hello,
This function was copied into my code, which was compiled without error/warning, but when executed there is always Segmentation fault at the end after the output (which seems correct!):
void get_hashes(unsigned int hash, unsigned char *in)
{
unsigned char *str = in;
int pos =... (7 Replies)
Discussion started by: yifangt
7 Replies
LEARN ABOUT X11R4
xkballoccompatmap
XkbAllocCompatMap(3) XKB FUNCTIONS XkbAllocCompatMap(3)NAME
XkbAllocCompatMap - Allocate a new compatibility map if you do not already have one available
SYNOPSIS
Status XkbAllocCompatMap ( xkb, which, num_si )
XkbDescPtr xkb;
unsigned int which;
unsigned int num_si;
ARGUMENTS
- xkb keyboard description in which to allocate compat map
- which
mask of compatibility map components to allocate
- num_si
number of symbol interpretations to allocate
DESCRIPTION
xkb specifies the keyboard description for which compatibility maps are to be allocated. The compatibility map is the compat field in this
structure.
which specifies the compatibility map components to be allocated (see XkbGetCompatMap). which is an inclusive OR of the bits shown in Ta-
ble 1.
Table 1 Compatibility Map Component Masks
---------------------------------------------------------------
Mask Value Affecting
---------------------------------------------------------------
XkbSymInterpMask (1<<0) Symbol interpretations
XkbGroupCompatMask (1<<1) Group maps
XkbAllCompatMask (0x3) All compatibility map components
num_si specifies the total number of entries to allocate in the symbol interpretation vector (xkb.compat.sym_interpret).
XkbAllocCompatMap returns Success if successful, BadMatch if xkb is NULL, or BadAlloc if errors are encountered when attempting to allocate
storage.
STRUCTURES
typedef struct {
KeySym sym; /* keysym of interest or NULL */
unsigned char flags; /* XkbSI_AutoRepeat, XkbSI_LockingKey */
unsigned char match; /* specifies how mods is interpreted */
unsigned char mods; /* modifier bits, correspond to eight real modifiers */
unsigned char virtual_mod; /* 1 modifier to add to key virtual mod map */
XkbAnyAction act; /* action to bind to symbol position on key */
} XkbSymInterpretRec,*XkbSymInterpretPtr;
DIAGNOSTICS
BadAlloc Unable to allocate storage
BadMatch A compatible version of Xkb was not available in the server or an argument has correct type and range, but is otherwise
invalid
SEE ALSO XkbGetCompatMap(3)NOTES
Note that symbol interpretations in a compatibility map (the sym_interpret vector of XkbSymInterpretRec structures) are also allocated
using this same function. To ensure that there is sufficient space in the symbol interpretation vector for entries to be added, use XkbAl-
locCompatMap specifying which as XkbSymInterpretMask and the number of free symbol interpretations needed in num_si.
X Version 11 libX11 1.2.1 XkbAllocCompatMap(3)