`new' will allocate memory for exactly one object of type `ClassA' and yield the address of the 1-st memory cell at which the definition of the object will start. In
Code:
ClassA *point;
point = 0;
you're not creating any object at all but just explictily stating that the pointer `point' will point to the zero-th cell. In that case your pointer merely becomes the so called `null pointer' - a special kind of pointers which do not point to any valid memory address.
I might err, so please correct me, if I'm wrong
---------- Post updated at 11:20 AM ---------- Previous update was at 11:20 AM ----------
as far as I remember, in
Code:
ClassA * point;
point = new ClassA;
`new' will allocate memory for exactly one object of type `ClassA' and yield the address of the 1-st memory cell at which the definition of the object will start. In
Code:
ClassA *point;
point = 0;
you're not creating any object at all but just explictily stating that the pointer `point' will point to the zero-th cell. In that case your pointer merely becomes the so called `null pointer' - a special kind of pointers which do not point to any valid memory address.
Hi
We are using a code generator for initializing structures with the #define macro. Compiling it with the GCC 2.8.1 (with -ansi) it OK. But when we are using the SUN C 5.0 compiler it screams.
Following is a code sample:
#include <stdlib.h>
#include <stdio.h>
typedef struct TEST3 {... (4 Replies)
If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it:
(1) one is to pass a pointer-to-pointer parameter, like:
int my_malloc(int size, char **pmem)
{
*pmem=(char *)malloc(size);
if(*pmem==NULL)... (11 Replies)
im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento)
typedef struct elemento
{
char name;
char value;
List<struct elemento> ltElementos;
... (7 Replies)
I'll be gratefull for any help. Thanks.
:)
This is the non class type error:
# g++ -I/usr/include/mysql -I/usr/include/mysql++ -lmysqlpp -L/usr/lib/mysql -L/usr/local/lib/mysql++ loaddsgsports.cpp -o loaddsgsports
loaddsgsports.cpp: In function âint outputToImport(const char*, const char*,... (1 Reply)
Hi,
I believe the next code is wrong:
class Egg {
Egg e;
int i;
Egg(int ii=0) : i(ii) {}
};
because you would end up with an endless definition (memory allocation) of Egg objects, thus int i.
Ok, so God Eckel proposes for a singleton:
class Egg {
static Egg e;
int... (5 Replies)
Hi all!
I am trying to register a device in an existing device class, but I am
having trouble getting the pointer to an existing class.
I can create a class in a module, get the pointer to it and then use
it to register the device with:
*cl = class_create(THIS_MODULE, className);... (0 Replies)
I have the two class definition as follows.
class A { public: int a; };
class B : virtual public A{ };
The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Hello All,
I am a learner in C++. I was testing my inheritance knowledge with following piece of code.
#include <iostream>
using namespace std;
class base
{
public :
void display()
{
cout << "In base display()" << endl;
}
void display(int k)
{... (2 Replies)
const int VALUES = {7,4,2,1,0}; //or int VALUES = {7,4,2,1,0};this statement inside a class definition gives error. Why? (3 Replies)
Discussion started by: milhan
3 Replies
LEARN ABOUT BSD
checkobj
CHECKOBJ(1) General Commands Manual CHECKOBJ(1)NAME
checkobj - check an object file to see whether it can be executed
SYNTAX
checkobj [ -s ] [ -f ] [ -40 ] [ file ... ]
DESCRIPTION
Checkobj attempts to determine whether the named files are valid executable binary files. It checks for size restrictions, including those
due to the granularity of memory management on the PDP11. It is especially useful for overlaid object files, where there are a number of
constraints. If a file is too large or improperly laid out, checkobj attempts to point out format changes that would allow the program to
run.
OPTIONS
Several options control the checks:
-s Check for the use of separate I/D. If the file is separate executable, an error is flagged, and an appropriate way to load for a
nonseparate machine is suggested if possible.
-f Check for the use of floating point arithmetic without inclusion of the floating-point interpreter.
-40 Combine the -s and -f options, to check for suitability for an 11/40-class PDP11.
BUGS
The test for floating point is simple-minded. It is based on the definition of ``fltused'' by the C compiler and ``fptrap'' in the float-
ing-point simulator. This test does not work if the object has been stripped.
DIAGNOSTICS
The exit status is 0 if all named files are runnable with the specified options, nonzero otherwise.
AUTHOR
Mike Karels, University of California, Berkeley
3rd Berkeley DistributionCHECKOBJ(1)