null

NULL definition problem on 64 bit system

二次信任 提交于 2020-01-01 18:18:34
问题 I'm running on RHEL 5.1 64 bit platfrom using gcc 4.1.2. I have a utility function: void str_concat(char *buff, int buffSize, ...); which concats char * passed in variadic list(...), while last argument should be NULL, to designate end of the arguments. On 64 bit system NULL is 8 bytes. Now to the problem. My application includes directly/indirectly 2 stddef.h files. First one is /usr/include/linux/stddef.h which defines NULL as following: #undef NULL #if defined(__cplusplus) #define NULL 0

NULL definition problem on 64 bit system

£可爱£侵袭症+ 提交于 2020-01-01 18:18:29
问题 I'm running on RHEL 5.1 64 bit platfrom using gcc 4.1.2. I have a utility function: void str_concat(char *buff, int buffSize, ...); which concats char * passed in variadic list(...), while last argument should be NULL, to designate end of the arguments. On 64 bit system NULL is 8 bytes. Now to the problem. My application includes directly/indirectly 2 stddef.h files. First one is /usr/include/linux/stddef.h which defines NULL as following: #undef NULL #if defined(__cplusplus) #define NULL 0

Are there different kinds of NULLs?

梦想的初衷 提交于 2020-01-01 13:27:07
问题 This came from <cfquery name="data"> SELECT NULL AS plainNull, CAST(NULL AS datetime) AS Due_Date </cfquery> Are these two different kinds of nulls? What is the difference Note: adapted from How can I call a function in another CFC file from within a query of a function in one cfc file? 回答1: Yes, there is a difference - but not the way you may be thinking. It is not that NULL has a data type per se, one will be associated with it (implicitly or explicitly) as part of evaluating the SQL. With

c# xml serialization doesn't write null

血红的双手。 提交于 2020-01-01 12:09:19
问题 when I serialize a c# object with a nullable DateTime in it, is there a way to leave the null value out of the xml file instead of having <EndDate d2p1:nil="true" xmlns:d2p1="http://www.w3.org/2001/XMLSchema-instance" /> 回答1: You can use the Specified extended property to leave out null values (or any other value, for that matter). Basically, create another property with the same name as the serialized property with the word Specified added to the end as a boolean. If the Specified property

c# xml serialization doesn't write null

笑着哭i 提交于 2020-01-01 12:09:03
问题 when I serialize a c# object with a nullable DateTime in it, is there a way to leave the null value out of the xml file instead of having <EndDate d2p1:nil="true" xmlns:d2p1="http://www.w3.org/2001/XMLSchema-instance" /> 回答1: You can use the Specified extended property to leave out null values (or any other value, for that matter). Basically, create another property with the same name as the serialized property with the word Specified added to the end as a boolean. If the Specified property

Why object has to be nulled for IE after it was document.getElementById-ed?

↘锁芯ラ 提交于 2020-01-01 11:45:11
问题 I often see in third party JavaScript code that after: var el = document.getElementById(elementId); object is often nulled and comment along this operation says that it is done for IE: el = null; // IE What's the real purpose? Any resource on that? 回答1: By nixing a reference they break the corresponding cyclic dependency between the DOM object and JavaScript objects, which are controlled by different sub-systems in older IE (thus being impossible to be garbage-collected). For example: var el

Java: setting a reference to null won't affect the object

限于喜欢 提交于 2020-01-01 11:34:31
问题 I've got a simple question. In this code below, why is s3's value still printed although I set it to null before. It seems gargbage collector won't get called. public class Test { public static void main(String[] args) { String s1 = "abc", s2 = "def", s3 = "ghj"; String sarr[] = {s1, s2, s3}; s3 = null; System.gc(); for(int i = 0; i < sarr.length; i++) { System.out.print(sarr[i] + " "); //prints abc def ghj } } } Any thoughts would be appreciated. 回答1: When you write: // Moved [] to make it

MySQL using BETWEEN comparison with NULL

老子叫甜甜 提交于 2020-01-01 10:58:10
问题 I have a query with a where condition like so: WHERE A.event_date BETWEEN B.start_date AND B.end_date The complexity is that if B.start_date is NULL, it means from time immemorial, similarly B.end_date is NULL, it means the present. So I still want to select a row where A.event_date > B.start_date and B.end_date is NULL , for example. The long-winded way to do this is WHERE A.event_date BETWEEN B.start_date AND B.end_date OR (A.event_date > B.start_date AND B.end_date IS NULL) OR (B.start

SQL Server does not use an index comparing datetime to not null

瘦欲@ 提交于 2020-01-01 10:12:32
问题 I have a simple table not related to any other. It has a not PK column that it is a date. I have created a non-clustered index to that column. If I make this query: select * from table where datecolumn is not null <-- does not use the index and goes really slow. But if I remove the not, this way: select * from table where datecolum is null <-- uses the index and goes really fast. There are much more not nulls than nulls. Am I forgetting something? Could I use filtered index here? Thanks in

What to do with null fields in compare()?

青春壹個敷衍的年華 提交于 2020-01-01 07:32:11
问题 In Java, I use a class in which some fields can be null . For example: class Foo { String bar; //.... } I want to write a BarComparator for this class, private static class BarComparator implements Comparator<Foo> { public int compare( final Foo o1, final Foo o2 ) { // Implementation goes here } } Is there a standard way to deal with the fact that any of o1 , o2 , o1.bar , o2.bar can be null , without writing lots of nested if ... else ? Cheers! 回答1: I guess you could wrap the call to the