C :: Initializing Paging In Kernel

Oct 7, 2014

I am having issues with trying to implement JameM's kernel. I page fault attempting to assign the return value of place_ordered_array into the kheap.The malloc function should remain between 10000000-20000000 yet I exceed this. I have a hunch it's due that I am using grub2 (he uses legacy) and it loads modules at a higher address. I tested this by debugging at alloc and found that the function cannot handle above about 20000000. Am I on track to say I must attempt to move the module or code to prevent trampling or that I should switch to legacy.

View 1 Replies


ADVERTISEMENT

C# :: Data Source Does Not Support Server-side Data Paging

Apr 20, 2014

Been trying to configure the GridView to display ony 4 rows of data at a time. I thought it wasn't working because I forgot to set AllowPaging to True, but after I did that, I just get the error of

The data source does not support server-side data paging.

Source Error:
Line 66: titlesGridView.DataBind(); // displays query results

Here is my Books.aspx.cs code:

// Fig. 29.11: Books.aspx.cs
// Code-behind file for the password-protected Books page.
using System;
using System.Data.Entity;
using System.Linq;
namespace Bug2Bug.ProtectedContent {
public partial class Books : System.Web.UI.Page {

[Code] ....

Am I missing anything or doing something wrong thats not causing it to page & only display 4 titles at a time?

View 2 Replies View Related

C++ :: Constructor Not Initializing Array?

Mar 6, 2015

I am making a tictactoe program that requires me to have a 3 by 3 two dimensional array of integers, in which the constructor should initialize the empty board to all zeroes. The program complies, but it keeps outputting garbage values and i'm not entirely sure why, My print function isn't complete yet, since I want to print out the array in a tic tac toe format, but i'm more concerned with why it's printing garbage values, here is my code:

Code:

// header file
#include <iostream>
#include <array>

[Code] ....

View 7 Replies View Related

C++ :: Initializing Variables In Each Class

Sep 26, 2014

I am working on a homework assignment and have most of the program working, but when I try to compile it keeps telling me to initialize the coin variables in each class. However, they are supposed to be added then removed so I don't want to set them back to zero.

Rewrite the Purse program given in Page 35 with functions to perform insert and remove operations. The function insert (int p, int n, int d, int q) will initialize pennies, nickels, dimes and quarters. The function dollars() will return the dollars. The function remove (int p, int n, int d, int q) will subtract pennies, nickels, dimes and quarters. The function display() returns a new String to print the content of the purse with remaining pennies, nickels, dimes and quarters.

Code:
usingnamespace std;
int insert_money (int *p, int *n, int *d, int *q);
int remove_money (int *p, int *n, int *d, int *q);
int dollars();
int main()

[Code] ....

View 2 Replies View Related

C++ :: Initializing Static Member Just Once Throughout

Jul 24, 2014

Here I'm trying to initialize PersonFactory::ethnicSurnames just once for the entire run of the program:

#include <iostream>
#include <string>
#include <vector>
#include <array>

enum Country {India, China, France, NumCountries}; // plus many other countries
struct School {}; struct Mall {}; struct HockeyArena {};

[Code] ....

Output:

PersonFactory::initializeEthnicNames() called
Carrying out the initialization...
PersonFactory::initializeEthnicNames() called
PersonFactory::initializeEthnicNames() called
PersonFactory::initializeEthnicNames() called
PersonFactory::initializeEthnicNames() called
numberOfTimesInitialized = 1

As you can see, even though five PersonFactory objects were constructed, the ethnicNames initialization only occurred once, as desired. However, there are some issues with my method. First of all, the use of the comma operator is ugly in my opinion. But fashion statements aside, PersonFactory::initializeEthnicNames() is still called multiple times, which is not good, even though it correctly avoids reinitializing ethnicNames after the first call. Also, I now forever get the annoying compiler warnings that the bool namesInitialized is never used, which is true, thus wasting a small bit of memory. And finally, I cannot declare ethnicNames const now, and it is supposed to be const. Any better way to accomplish what I'm trying to do?

By the way, the reason why I don't initialize ethnic names outside the class as is normally done for static data members (and that would indeed allow me to declare it const) is because it would get messed up if I later change the order of the elements in enum Country. Hence actual lines of initializations I think are needed. And I do want ethnicSurnames inside PersonFactory, because I feel it really does belong there. Also, PersonFactory is not to be Singleton, because it has data members that depend on some parameters in its constructor (e.g. geographic location).

View 5 Replies View Related

C++ ::  initializing Variables In Program

Oct 24, 2013

I want to know how to make variables during the program. for example in a program i want to have the player be able to create their own spells or add their own weapons to the game without having to edit the source code. i use sfml 2.0

View 4 Replies View Related

C++ :: Initializing A Class To A Pointer?

Feb 4, 2014

I came across a piece of c++ code that seems to be initializing a class object like this:

ImapMailbox *mailbox;

Now the class looks like this:

class ImapMailbox {
public:
ImapMailbox();
ImapMailbox (const QString& mailbox);
~ImapMailbox();
// Methods
void addMessage (ImapMessage *message);

[Code]...

And the constructor looks like this:

ImapMailbox::ImapMailbox()
: d(new ImapMailboxPrivate)
{
d->unseen = d->exists = d->recent = 0;
d->readWrite = false;
d->flags = 0;
}

But this does not seem to be an array like object. So what exactly could this be pointing to?

View 2 Replies View Related

C++ :: Initializing Object Through Constructor

Oct 15, 2013

sth is in my mind.

fast way of initializing an object through constructor is

Fred::Fred() : x_(whatever) { }

slow way
Fred::Fred() { x_ = whatever; }

ok. i accept it is faster but why?? what is the difference compiler does.

View 6 Replies View Related

C++ :: Variable Not Being Declared Before Initializing - But It Is?

Mar 31, 2014

I'm working on this program, and when i run it for 'p', 'P', or for a incorrect service code a error message pops up saying that "totalCost is being used without being initialized". I don't want to change it to switches, case, and breaks now because I've come too far to change it all. I have that variable right here just below.

#include <iomanip>
#include <iostream>
using namespace std;
int main() {
int acctCode;
double nightCost;
double totalCost;

[Code] ....

View 4 Replies View Related

C++ :: Initializing Struct On Declaration

Dec 20, 2013

Code:

struct foo {
char label[64];
int state;
} bar[3] = { };

Will the above code ALWAYS initialize to 0 all objects:

bar[0].label
bar[0].state
bar[1].label
bar[1].state
bar[2].label
bar[2].state

Using gcc and g++, it does in my testing But was wondering if it can be unsafe under some circumstances.

I even tried without = { } and it is still initialized to 0 for all objects!

View 5 Replies View Related

C/C++ :: Initializing Pointer To NULL?

May 17, 2014

So I'm writing a small program for class, and for some reason I keep getting an error when trying to initialize head to NULL. Even threw in the namespace just to see, nothin'.

#ifndef NUMBERLIST_H
#define NUMBERLIST_H
using namespace std;

[Code].....

There's my header file. Not sure what I'm doing wrong with the constructor.

EDIT: Got it to work with nullptr, but still curious why that isn't working

View 2 Replies View Related

C/C++ :: Initializing Array Of Structures

Feb 25, 2014

How to initialize this array of structures in my code

struct CustomerAddress; {
string street;
string city;
string state;
int zip;

[Code] ....

I am going to be using a boolean variable to mark whether or not a specific field has had data entered into it. I figure the best way to do that is to initialize all the elements of the structures to 0. However, with strings and with the nested structure, I'm not sure how to do this.

View 6 Replies View Related

C/C++ :: Initializing Constructor In CPropertyPage?

Aug 21, 2013

Here is a declaration of property class
class CMyPropertyPage11 : public CPropertyPage

Here is the definition
CMyPropertyPage11::CMyPropertyPage11() : CPropertyPage(CMyPropertyPage11::IDD)

I really do not understand the role of the
CPropertyPage(CMyPropertyPage11::IDD)

But I need to derive CMyPropertyPage11 from another CPropertyPage, say CBasePropertyPage adn really need to know how to implement the CPropertyPage(CMyPropertyPage11::IDD) initialization again.

View 3 Replies View Related

C++ :: Initializing A POD Bitfield Struct?

Apr 14, 2014

I'm wondering what is the "best" way to initialize a bitfield struct. I have this bitfield, defined as:

Code:
struct S
{
unsigned int a : 1;
unsigned int b : 1;
};

If I'm "using" the bitfield, I can initialize it easily when declaring it, as so:

Code:
int main()
{
S s = {0};
}

Now, the issue I'm facing is that I want to embed S inside another struct, which I'll name "outer". EG:

Code:
struct Outer
{
S s;
};

I'm wondering what the "best" way to have Outer initialize S is? I've seen a lot of people use the "union" approach:

Code:
struct Outer
{
Outer()
{
u.all = 0;
}
union
{
unsigned char all;
S s;
} u;
};

but:This adds an extra field depth (the union's u)Does bit hacking, in a way (is the bitfield as large as my field?) I'd have wanted to initialize the field in my constructor, as so:

Code:
Outer::Outer() : s({0})

However, this would appear to be a C++11 feature only.

I have, however, "observed" that by simply "empty constructing" s, eg:

Code:
Outer::Outer() : s(){} //Initialize s ?
vs
Outer::Outer(){}

Then my bitfield "appears" initialized.

View 5 Replies View Related

C :: Segmentation Fault -> Main Not Initializing

Mar 14, 2013

This program is compiling just fine but is not running. Even, Main is not initializing, Here is my code

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int pow2(int n) {
printf("POW2");
int pow = 1;

[Code] ....

View 2 Replies View Related

C++ :: Initializing Double Pointer Array?

Aug 1, 2013

How to initialize double pointer array..?

int (**aLines)[2];

View 3 Replies View Related

C++ :: Reading In And Initializing Data From File

Oct 30, 2014

Im familiar with fstream and know how to read in data, given that there is one type per line.

But I have a file that has multiple lines each containing a string (an address) and two double values (latitude and longitude).

Looking for support with the logic part of reading in data and initializing them to member variable.

View 1 Replies View Related

C++ :: Initializing 2D Dynamic Array With All Entries 0?

Dec 29, 2013

is it possible to create a dynamic array with all entries in it equal to 0?

int** adjMatrix;
adjMatrix= new int*[numOfVertices];
for(int i=0; i<numOfVertices; i++){
adjMatrix[i]=new int[numOfVertices];
}

View 1 Replies View Related

C++ :: Error Initializing Map - Ambiguous Operator

Feb 9, 2014

Okay so inside my ArcherArmor.cpp, I'm trying to figure out why the map initializer list isn't working, but for some reason I keep getting "Error C2593: 'operator =' is ambiguous". Here is my code:

I also have a class which ArcherArmor is derived from, that has a struct called `Armor`, which I left out for simplicity. The main problem is that error! The only thing I can think of is that im initializing the map wrong.

//ArcherArmor.h
#include <string>
#include <map>
class ArcherArmor {
private:
map <int, Armor> soldier_armor;
public:
void ArcherArmor_shop();

[Code] .....

View 7 Replies View Related

C++ :: Initializing Map - No Matching Constructor For Initialization

Nov 18, 2014

I am trying to create a `std::map` from `std:: string` to a pointer to member function type. I'm initializing the `map` with an initializer list (braced). When I compile, I get a message from the compiler: No matching constructor for initialization.

Example: [URL] .....

View 4 Replies View Related

C++ :: Initializing Local One Dimension Array?

Jul 31, 2013

Want to initialize a local one dimensional array. How can I do the same without a loop?

Found from some links that
int iArrayValue[25]={0};
will initialize all the elements to ZERO. Is it?
If yes then can we write below code to initialize the elements to a non-ZERO value?

int iArrayValue[25]={4};

Do we have some other way to initialize an array to a non-ZERO value? Memset can initialize the element to ZERO.

View 7 Replies View Related

C++ :: Initializing Multidimensional String Array?

Nov 15, 2014

In one of my programs I have a 3x3 array of string that I use to display the outcome to rock, paper, scissors, and another 1x3 used for a number guessing game. I have the arrays declared in the header file as follows:

//Games.h
std::string rpsOutcome[3][3];
std::string hiLoOutcome[3];

and then initialized them in the cpp file:

//Games.cpp
string rpsOutcome[3][3] {
//row 1
{ "Both of you picked rock, you tied. Try again",
"You picked rock, the computer picked paper, you lose",

[code]....

From what I've read, Im pretty sure thats how your supposed to initialize multidimensional arrays (using the nested braces), but when I build the project, I get the following error:

123456789101112
1
1> RockPaperScissors.cpp
1> Games.cpp
1>c:userswuubbgoogle drivevisual studio projectsgamesgamesgames.cpp(75): error C2374: 'games::rpsOutcome' : redefinition; multiple initialization

[Code] .....

View 4 Replies View Related

C++ :: Initializing / Filling Container With Sample Of Another

May 22, 2014

I have a vector that I want to use to source another vector, something like copy_if, but without the need to allocate space first:

bool is_odd( const int x ){ return x % 2 == 1; }
std::vector< int > numbers = { 1, 2, 3, 4, 5, 6 };
std::vector< int > odd_numbers;
std::sweet_function( numbers.begin(), numbers.end(), odd_numbers, is_odd );
// odd_numbers is { 1, 3, 5 }

Even better might be a std::transform_if

View 5 Replies View Related

C++ :: Initializing Const Data Member

Apr 11, 2014

What I need to know is how I can pass an argument to the Book constructor so I can change the const data member Category (with cascading capacity if possible. I also posted some of my set functions for further comprehension.

class Book
{
friend void CompPrice(Book &,Book&); //friend function that has access to the member functions of this class
//The arguments sent to it are by address, and of type the class Book, so that it can have access to its member functions
private: //private data members

[Code].....

View 2 Replies View Related

C++ :: Initializing Vector Of Vectors Of Strings

Dec 6, 2012

I thought that C++0x made it possible for vectors to be initialized with an initializer list, such as:

Code: vector<vector<string> > vv {{"hello", "goodbye", ""}};

I tried this syntax in both VS 2010 & VS 2012 Express For Desktop, and I get the same error in both compilers:

compiler error: non-aggregates cannot be initialized with initializer list

To put the code above in context, I'm going to have a .txt file with hundreds of thousands of string arrays, in initializer list format, such as:

{"string","string","string","","",""},{"string","string","string","","",""},{"string","string","string","","",""}...and so on

The first 3 strings in each array will be non-zero in length, and the last 3 strings in each array will be empty, as shown above.

I want to be able to cut and paste the arrays right into the declaration, either with:

string arrayOfArrays[0][6] = {{"string","string","string","","",""},{"string","string","string","","",""},{"string","string","string","","",""}...and so on };
or
vector<vector<string> > vecOfVectors = {{"string","string","string","","",""},{"string","string","string","","",""},{"string","string","string","","",""}...and so on };

I know I can do the first, but apparently the second declaration method with vectors won't work. I would like to work with vectors, but I'm not sure about the initialization. The .txt file will be what it is, so the initialization will have to be able to work with its 'array-like initializer' format.

View 10 Replies View Related

C++ :: Crash When Initializing Indices Array

Nov 26, 2012

Why I get a crash when initializing the indices array below (bottom)-

Code:
struct TerrainGroupData {
TerrainGroupData(){};
TerrainGroupData(Ogre::Vector3 ** iVertices, unsigned long ** iIndices, size_t* iFaceNum, size_t* iVertNum) {
vertices = iVertices;
indices = iIndices;

[Code] ...

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved