I am wondering , what exactly is stored in the memory when we say a particular variable pointer to be NULL. suppose I have a structure, say
typdef struct MEM_LIST MEM_INSTANCE;
struct MEM_LIST
{
char *start_addr;
int size;
MEM_INSTANCE *next;
};
MEM_INSTANCE *front;
front = (MEM_INSTANCE*)malloc(sizeof(MEM_INSTANCE*))...
Ok, so I know that technically this is undefined behavior, but nonetheless, I've seen this more than once in production code. And please correct me if I'm wrong, but I've also heard that some people use this "feature" as a somewhat legitimate substitute for a lacking aspect of the current C++ standard, namely, the inability to obtain the...
I have a table with sales per store as follows:
SQL> select * from sales;
ID ID_STORE DATE TOTAL
---------- -------- ---------- -------------------------------
1 1 2010-01-01 500.00
2 1 2010-01-02 185.00
3 1 2010-01-03 135.00
4 1 2009-01-01 165.00...
I have a text source with nulls in it and I need to pull them out along with my regex pattern. Can regex even match a null character?
I only realized I had them when my pattern refused to match and when I pasted it into Notepad++ it showed all the null characters.
...
According to,
http://www.freshvanilla.org:8080/display/www/Java+Interview+Questions
Under,
Which class is the superclass of every
class?
null seems to be the answer.
I found that
new Object().getClass().getSuperClass()
verifies the answer as correct.
But can null be considered a class?
I see all primitive data types are re...
I'm constructing a Hibernate Criterion, using a subselect as follows
DetachedCriteria subselect =
DetachedCriteria.forClass(NhmCode.class, "sub"); // the subselect selecting the maximum 'validFrom'
subselect.add(Restrictions.le("validFrom", new Date())); // it should be in the past (null needs handling here)
subselect.add(Property.f...
Wordpress ships with the wpdb class which handles CRUD operations. The two methods of this class that I'm interested in are the insert() (the C in CRUD) and update() (the U in CRUD).
A problem arises when I want to insert a NULL into a mysql database column - the wpdb class escapes PHP null variables to empty strings. How can I tell Wor...
I vaguely remember reading about this a couple of years ago, but I can't find any reference on the net.
Can you give me an example where the NULL macro didn't expand to 0?
Edit for clarity: Today it expands to either ((void *)0), (0), or (0L). However, there were architectures long forgotten where this wasn't true, and NULL expanded to...
I'm asking because of the discussion that's been provoked in this thread.
Trying to have a serious back-and-forth discussion using comments under other people's replies is not easy or fun. So I'd like to hear what our C experts think without being restricted to 500 characters at a time.
The C standard has precious few words to say a...
I want to perform some action ONLY IF my string has a meaningful value. So, I tried this.
if (!myString.equals("")) {
doSomething
}
and this
if (!myString.equals(null)) {
doSomething
}
and this
if ( (!myString.equals("")) && (!myString.equals(null))) {
doSomething
}
and this
if ( (!myString.equals("")) && (myString!=null)) {
do...
This is a problem one of our developers brought to me. He stumbled across an old stored procedure which used 'WHERE col = NULL' several times. When the stored procedure is executed it returns data.
If the query inside the stored procedure is executed manually it will not return data unless the 'WHERE col = NULL' references are changed t...
Let's say there's a table created as follows:
create table testTable ( colA int not null )
How would you drop the not null constraint? I'm looking for something along the lines of
ALTER TABLE testTable ALTER COLUMN colA DROP NOT NULL;
which is what it would look like if I used PostgreSQL. To my amazement, as far as I've been able t...
The following code does not compile:
//int a = ...
int? b = (int?) (a != 0 ? a : null);
In order to compile, it needs to be changed to
int? b = (a != 0 ? a : (int?) null);
Since both b = null and b = a are legal, this doesn't make sense to me.
Why do we have to cast the null into an int? and why can't we simply provide an explicit...
I am finding it hard to fugure out the reference system in AS 3.0.
this is the code i have (i have trimmed it down in order to find the problem but to no avail)
package rpflash.ui {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.display.Stage;
import nowplaying;
import flash.text.TextField;
public class RP...
I am aware you cannot use an initialiser list for an array. However I have heard of ways that you can set an array of pointers to NULL in a way that is similar to an initialiser list.
I am not certain how this is done. I have heard that a pointer is set to NULL by default, though I do not know if this is guaranteed/ in the C++ standard...
In my code, is there a shorthand that I can use to assign a variable the value of a object's property ONLY if the object isn't null?
string username = SomeUserObject.Username; // fails if null
I know I can do a check like if(SomeUserObject != null) but I think I saw a shorthand for this kind of test.
I tried:
string username = S...
I have a class, "Tetris", in which one of the instance variables is "board". "board" is 2D array of Color objects. Upon the creation of a tetris object I call a method that sets the dimensions of board and then sets all of the Color objects to be the Default value, that is to say, Color.blue.
public Tetris(int rows, int cols) {
this.r...
I've created a program to get a string input from a user and parse it into tokens and move a robot according to the input. The program is supposed to recognize these inputs(where x is an integer): "forward x" "back x" "turn left x" "turn right x" and "stop". The program does what it's supposed to for all commands except for "stop". When ...
Hi there,
I have the task of re-factoring an SQLServer DB.... A lot of the tables and columns "ALLOW NULLS", Is this good practice...
I seem to remember the authour of CSLA.NET saying it was really bad practice to allow nulls in a DB...
If this is the case, what are my alternatives?
Remove all "ALLOW NULLS" from all columns.... and ...
Hello,
I am using the following code to try and display in a time in a table cell.
TimeSlot *timeSlot = [timeSlots objectAtIndex:indexPath.row];
NSDateFormatter *timeFormat = [[NSDateFormatter alloc] init];
[timeFormat setDateFormat:@"HH:mm:ss"];
NSLog(@"Time: %@", timeSlot.time);
NSDate *mydate = timeSlot.time;
NSLog(@"Time: %@", myda...