I am getting the following warning for the below function. I understand what
it means but how do I handle a null reference? Then how do I pass the
resulting value?
Regards
Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A
null reference exception could occur at run time when the result is used.
G:\Project Development\Visual Studio
2005\Projects\Ascension\Ascension\SwephConversions .vb 64 3 Ascension
' Convert decimal hours to hours/minutes/seconds
Public Function Dec2hms(ByVal x As Decimal) As String
Dim hh As Int32, mm As Int32, ss As Decimal, remainder As Decimal
'Dim x a decimal, hh as integer
hh = CType(x, Integer)
remainder = (x - hh)
mm = CType((remainder * 60), Integer)
remainder = ((remainder * 60) - mm)
ss = Int(remainder * 60)
remainder = ((remainder * 60) - ss)
If remainder >= 0.5 Then
ss = ss + 1
Else
ss = ss
End If
hms = hh & "h " & mm & "m " & ss & "s"
End Function 27 3036
Return hh & "h " & mm & "m " & ss & "s"
"Terry" <ne*******@whiteHYPHENlightDOTme.ukwrote in message
news:uQ**************@TK2MSFTNGP02.phx.gbl...
>I am getting the following warning for the below function. I understand what it means but how do I handle a null reference? Then how do I pass the resulting value?
Regards
Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A
null reference exception could occur at run time when the result is used.
G:\Project Development\Visual Studio
2005\Projects\Ascension\Ascension\SwephConversions .vb 64 3 Ascension
' Convert decimal hours to hours/minutes/seconds
Public Function Dec2hms(ByVal x As Decimal) As String
Dim hh As Int32, mm As Int32, ss As Decimal, remainder As Decimal
'Dim x a decimal, hh as integer
hh = CType(x, Integer)
remainder = (x - hh)
mm = CType((remainder * 60), Integer)
remainder = ((remainder * 60) - mm)
ss = Int(remainder * 60)
remainder = ((remainder * 60) - ss)
If remainder >= 0.5 Then
ss = ss + 1
Else
ss = ss
End If
hms = hh & "h " & mm & "m " & ss & "s"
End Function
Stephany Young wrote:
Return hh & "h " & mm & "m " & ss & "s"
I don't know how much background you have in VB. I'll assume not much.
To clarify:
"Function 'Dec2hms' doesn't return a value on all code paths." means
that a function might not be returning a value along one of its
possible paths of execution, and that a line of code that calls the
function could get a Null Pointer from the function. In VB and VB.NET,
A Sub (Subroutine) is a procedure which never returns a value. A
Function is a procedure that MUST return a value.
To return a value from a function, use the keyword Return followed by
the value or variable that is being returned.
Placing
Return hh & "h " & mm & "m " & ss & "s"
at the end of the function (right above "end function") should fix the
problem.
Thanks Stephany,
I understand your explanation and what the warning is indicating. In order
to remove the warning I would need to ensure the function does not return a
null pointer. Is there a better syntax available giving a more complete
solution?
My experience comes from VBA and I have just started out in VB and .NET. The
structure and syntax is what I am trying to understand. The best way for me
is to have some good books, try converting some VBA code and visit these
newsgroups. Just wished I started 3 years ago.
Regards
<lo*********@gmail.comwrote in message
news:11**********************@k58g2000hse.googlegr oups.com...
>
Stephany Young wrote:
>Return hh & "h " & mm & "m " & ss & "s"
I don't know how much background you have in VB. I'll assume not much.
To clarify:
"Function 'Dec2hms' doesn't return a value on all code paths." means
that a function might not be returning a value along one of its
possible paths of execution, and that a line of code that calls the
function could get a Null Pointer from the function. In VB and VB.NET,
A Sub (Subroutine) is a procedure which never returns a value. A
Function is a procedure that MUST return a value.
To return a value from a function, use the keyword Return followed by
the value or variable that is being returned.
Placing
Return hh & "h " & mm & "m " & ss & "s"
at the end of the function (right above "end function") should fix the
problem.
First of all, let's get some terminology straight. The warning states:
Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A
null reference exception could occur at run time when the result is used.
Nowhere does it mention 'null pointer', it mentions 'null reference' and
that is a completely different animal.
For the sake of your own sanity it is important to remember that, for the
purpose of your learning curve, 'VB doesn't do pointers'.
Without going into the why's and wherefore's, some types in .NET are called
value types. These include String, Integer, DateTime and Boolean among
others. These are usually implemented as a Structure rather than as Class. A
type implemented as a Class is usually called a reference type.
In general, you can assing Nothing to a variable of a reference type and
that variable is considered to be unassigned.
When you assign Nothing to a variable of a value type, then, behind the
scenes, the default value for that particular value type is substituted. The
default value for a String is String.Empty, the default value for an Integer
is 0, the default value for a DateTime is 01/01/0001, the default value for
a Boolean is False and so on and so forth.
In VBA, you would have written a function something like:
Function Test() As String
Test = "Hello World!"
End Function
and you called it using something like:
x = Test()
The single statement in the function assigned a string as the return value
of the function. It used a syntax where you assigned the value to the name
of the function.
If you had coded the function as:
Function Test(ByVal flag As Boolean) As String
If value Then Test = "Hello World!"
End Function
Then the value "Hello World!" would be returned only if the parameter (flag)
had a value of True. If it had a value of false then, the function 'fell
through the logic' or 'took another path' and, because the type of the the
return value was declared as string, an empty string was automaticallty
returned.
In VB.NET, exactly the same thing applies, BUT, at compile time, you get a
warning that, at least one of the paths through the logic does not explicity
set a return value.
To avoid this warning, I recommend that you get into the habit of always
explicity setting return values from functions, like:
Function Test(ByVal flag As Boolean) As String
If value Then
Return "Hello World!"
Else
Return String.Empty
End If
End Function
Note that in Vb.Net, we assign the return value via the keyword 'Return'
rather than assigning to the function name. It is functionally equivalient
to, but probably more efficient:
Test = "Hello World!"
Exit Sub
The real difference is that 'Return <value>' assigns the return value and
returns immediately, all with a single statement.
"Terry" <ne******@whiteHYPHENlightDOTme.ukwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Thanks Stephany,
I understand your explanation and what the warning is indicating. In order
to remove the warning I would need to ensure the function does not return
a null pointer. Is there a better syntax available giving a more complete
solution?
My experience comes from VBA and I have just started out in VB and .NET.
The structure and syntax is what I am trying to understand. The best way
for me is to have some good books, try converting some VBA code and visit
these newsgroups. Just wished I started 3 years ago.
Regards
<lo*********@gmail.comwrote in message
news:11**********************@k58g2000hse.googlegr oups.com...
>> Stephany Young wrote:
>>Return hh & "h " & mm & "m " & ss & "s" I don't know how much background you have in VB. I'll assume not much. To clarify: "Function 'Dec2hms' doesn't return a value on all code paths." means that a function might not be returning a value along one of its possible paths of execution, and that a line of code that calls the function could get a Null Pointer from the function. In VB and VB.NET, A Sub (Subroutine) is a procedure which never returns a value. A Function is a procedure that MUST return a value. To return a value from a function, use the keyword Return followed by the value or variable that is being returned. Placing Return hh & "h " & mm & "m " & ss & "s" at the end of the function (right above "end function") should fix the problem.
On 2007-01-12, Terry <ne*******@whiteHYPHENlightDOTme.ukwrote:
I am getting the following warning for the below function. I understand what
it means but how do I handle a null reference? Then how do I pass the
resulting value?
Regards
Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A
null reference exception could occur at run time when the result is used.
G:\Project Development\Visual Studio
2005\Projects\Ascension\Ascension\SwephConversions .vb 64 3 Ascension
' Convert decimal hours to hours/minutes/seconds
Public Function Dec2hms(ByVal x As Decimal) As String
Dim hh As Int32, mm As Int32, ss As Decimal, remainder As Decimal
'Dim x a decimal, hh as integer
hh = CType(x, Integer)
remainder = (x - hh)
mm = CType((remainder * 60), Integer)
remainder = ((remainder * 60) - mm)
ss = Int(remainder * 60)
remainder = ((remainder * 60) - ss)
If remainder >= 0.5 Then
ss = ss + 1
Else
ss = ss
End If
hms = hh & "h " & mm & "m " & ss & "s"
End Function
The problem is that you are not returning a value at all that I can see.
Which means that the value of the function will always be a null reference.
There are two, ways to return a value from a function in vb.net. One, is the
same as the old vb way - and that is to assign the value to the function name:
Public Function Dec2hms As String
....
Dec2hms = hh & "h " & mm & "m " & ss & "s"
End Function
The other, prefered way is to use the Return statment:
Public Function Dec2hms As String
....
Return hh & "h " & mm & "m " & ss & "s"
End Function
Now, to avoid these kind of warnings, you just need to make sure that there is
a return along all normal code paths.... I personally like to structure code
so that there is only one exit point, so that often leads to code that looks
something like:
Public Function SomeFunc As Boolean
' i chose to default to a failure, but that
' can change based on what is easier and makes
' more sense for the method
Dim success As Boolean = False
' do cool stuff that might change the value of success
Return success
End Function
HTH,
--
Tom Shelton
Hi Stephany,
Excellent explanation, this makes sense to me;
If value Then
Return "Hello World!"
Else
Return String.Empty
End If
Thanks, regards
Terry
"Stephany Young" <noone@localhostwrote in message
news:en**************@TK2MSFTNGP02.phx.gbl...
First of all, let's get some terminology straight. The warning states:
Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A
null reference exception could occur at run time when the result is used.
Nowhere does it mention 'null pointer', it mentions 'null reference' and
that is a completely different animal.
For the sake of your own sanity it is important to remember that, for the
purpose of your learning curve, 'VB doesn't do pointers'.
Without going into the why's and wherefore's, some types in .NET are
called value types. These include String, Integer, DateTime and Boolean
among others. These are usually implemented as a Structure rather than as
Class. A type implemented as a Class is usually called a reference type.
In general, you can assing Nothing to a variable of a reference type and
that variable is considered to be unassigned.
When you assign Nothing to a variable of a value type, then, behind the
scenes, the default value for that particular value type is substituted.
The default value for a String is String.Empty, the default value for an
Integer is 0, the default value for a DateTime is 01/01/0001, the default
value for a Boolean is False and so on and so forth.
In VBA, you would have written a function something like:
Function Test() As String
Test = "Hello World!"
End Function
and you called it using something like:
x = Test()
The single statement in the function assigned a string as the return value
of the function. It used a syntax where you assigned the value to the name
of the function.
If you had coded the function as:
Function Test(ByVal flag As Boolean) As String
If value Then Test = "Hello World!"
End Function
Then the value "Hello World!" would be returned only if the parameter
(flag) had a value of True. If it had a value of false then, the function
'fell through the logic' or 'took another path' and, because the type of
the the return value was declared as string, an empty string was
automaticallty returned.
In VB.NET, exactly the same thing applies, BUT, at compile time, you get a
warning that, at least one of the paths through the logic does not
explicity set a return value.
To avoid this warning, I recommend that you get into the habit of always
explicity setting return values from functions, like:
Function Test(ByVal flag As Boolean) As String
If value Then
Return "Hello World!"
Else
Return String.Empty
End If
End Function
Note that in Vb.Net, we assign the return value via the keyword 'Return'
rather than assigning to the function name. It is functionally equivalient
to, but probably more efficient:
Test = "Hello World!"
Exit Sub
The real difference is that 'Return <value>' assigns the return value and
returns immediately, all with a single statement.
"Terry" <ne******@whiteHYPHENlightDOTme.ukwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Thanks Stephany,
I understand your explanation and what the warning is indicating. In order to remove the warning I would need to ensure the function does not return a null pointer. Is there a better syntax available giving a more complete solution?
My experience comes from VBA and I have just started out in VB and .NET. The structure and syntax is what I am trying to understand. The best way for me is to have some good books, try converting some VBA code and visit these newsgroups. Just wished I started 3 years ago.
Regards
<lo*********@gmail.comwrote in message news:11**********************@k58g2000hse.googleg roups.com...
>>> Stephany Young wrote: Return hh & "h " & mm & "m " & ss & "s"
I don't know how much background you have in VB. I'll assume not much. To clarify: "Function 'Dec2hms' doesn't return a value on all code paths." means that a function might not be returning a value along one of its possible paths of execution, and that a line of code that calls the function could get a Null Pointer from the function. In VB and VB.NET, A Sub (Subroutine) is a procedure which never returns a value. A Function is a procedure that MUST return a value. To return a value from a function, use the keyword Return followed by the value or variable that is being returned. Placing Return hh & "h " & mm & "m " & ss & "s" at the end of the function (right above "end function") should fix the problem.
Thanks Tom,
Good points. I will use the Return statement for the reasons given by
Stephany in his post, but setting an initial value for the Return may be
advantageous and less code lines. In your example setting success=False
(fail) is similar to how I checked for successful table updates in VBA, True
would mean there were no errors and Commit, False caused a Rollback. In my
function I'll set hms as empty.
I'll give both suggested methods a trial just for the coding experience.
As an aside, in VBA it was necessary to explicitly check the value of a
boolean variable 'If myBool = True Then...'. This is because there can be
the occasional problem encounted if you used 'If myBool Then...', it's a VBA
thing. Any such problems with VB.NET?
Regards
Terry
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:9N******************************@comcast.com. ..
On 2007-01-12, Terry <ne*******@whiteHYPHENlightDOTme.ukwrote:
>I am getting the following warning for the below function. I understand what it means but how do I handle a null reference? Then how do I pass the resulting value?
Regards Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. G:\Project Development\Visual Studio 2005\Projects\Ascension\Ascension\SwephConversion s.vb 64 3 Ascension
' Convert decimal hours to hours/minutes/seconds
Public Function Dec2hms(ByVal x As Decimal) As String
Dim hh As Int32, mm As Int32, ss As Decimal, remainder As Decimal
'Dim x a decimal, hh as integer
hh = CType(x, Integer)
remainder = (x - hh)
mm = CType((remainder * 60), Integer)
remainder = ((remainder * 60) - mm)
ss = Int(remainder * 60)
remainder = ((remainder * 60) - ss)
If remainder >= 0.5 Then
ss = ss + 1
Else
ss = ss
End If
hms = hh & "h " & mm & "m " & ss & "s"
End Function
The problem is that you are not returning a value at all that I can see.
Which means that the value of the function will always be a null
reference.
There are two, ways to return a value from a function in vb.net. One, is
the
same as the old vb way - and that is to assign the value to the function
name:
Public Function Dec2hms As String
....
Dec2hms = hh & "h " & mm & "m " & ss & "s"
End Function
The other, prefered way is to use the Return statment:
Public Function Dec2hms As String
....
Return hh & "h " & mm & "m " & ss & "s"
End Function
Now, to avoid these kind of warnings, you just need to make sure that
there is
a return along all normal code paths.... I personally like to structure
code
so that there is only one exit point, so that often leads to code that
looks
something like:
Public Function SomeFunc As Boolean
' i chose to default to a failure, but that
' can change based on what is easier and makes
' more sense for the method
Dim success As Boolean = False
' do cool stuff that might change the value of success
Return success
End Function
HTH,
--
Tom Shelton
Great summary; however there are a couple of mistakes in what you say which
I should point out.
"Stephany Young" <noone@localhostwrote in message
news:en**************@TK2MSFTNGP02.phx.gbl...
Without going into the why's and wherefore's, some types in .NET are
called value types. These include String, Integer, DateTime and Boolean
among others. These are usually implemented as a Structure rather than as
Class. A type implemented as a Class is usually called a reference type.
String is NOT a value type; it is a reference type. String is what's called
an immutable reference type (once created, the string will never change
value).
>
In general, you can assing Nothing to a variable of a reference type and
that variable is considered to be unassigned.
When you assign Nothing to a variable of a value type, then, behind the
scenes, the default value for that particular value type is substituted.
The default value for a String is String.Empty, the default value for an
Integer is 0, the default value for a DateTime is 01/01/0001, the default
value for a Boolean is False and so on and so forth.
Because of the above, the default value for an uninitialised string is
Nothing (null reference) not String.Empty. The difference is quite
important, as you will get a NullReferenceException if you attempt to do
anything with a string before it is assigned.
Hope this clarifies,
Nick Hall
Yes. Absolutely!!!
Because I never declare a string variable without initialising it, it easy
to forget some of the nuances of the String class when it is unitialised and
treat it as if it were a value type, which of course is quite wrong.
I stand reminded.
"Nick Hall" <ni***@aslan.nospam.co.ukwrote in message
news:eM*************@TK2MSFTNGP04.phx.gbl...
Great summary; however there are a couple of mistakes in what you say
which I should point out.
"Stephany Young" <noone@localhostwrote in message
news:en**************@TK2MSFTNGP02.phx.gbl...
>Without going into the why's and wherefore's, some types in .NET are called value types. These include String, Integer, DateTime and Boolean among others. These are usually implemented as a Structure rather than as Class. A type implemented as a Class is usually called a reference type.
String is NOT a value type; it is a reference type. String is what's
called an immutable reference type (once created, the string will never
change value).
>> In general, you can assing Nothing to a variable of a reference type and that variable is considered to be unassigned.
When you assign Nothing to a variable of a value type, then, behind the scenes, the default value for that particular value type is substituted. The default value for a String is String.Empty, the default value for an Integer is 0, the default value for a DateTime is 01/01/0001, the default value for a Boolean is False and so on and so forth.
Because of the above, the default value for an uninitialised string is
Nothing (null reference) not String.Empty. The difference is quite
important, as you will get a NullReferenceException if you attempt to do
anything with a string before it is assigned.
Hope this clarifies,
Nick Hall
The 'VBA thing' as you put it was primarily caused by the use of the variant
data type.
I recommend that, in ALL your VB.NET projects, you set Option Explicit and
Option Strict. Doing so will highlight places where such a problem is likely
to occur.
If you code:
Dim myBool As Boolean
If myBool Then
...
End If
then you won't run into that problem.
FYI and in case you want to upset me in the future, I'm a 'her', not a
'his'. ;)
"Terry" <it@REMOVETHISfloydautomatic.co.ukwrote in message
news:uj**************@TK2MSFTNGP06.phx.gbl...
Thanks Tom,
Good points. I will use the Return statement for the reasons given by
Stephany in his post, but setting an initial value for the Return may be
advantageous and less code lines. In your example setting success=False
(fail) is similar to how I checked for successful table updates in VBA,
True would mean there were no errors and Commit, False caused a Rollback.
In my function I'll set hms as empty.
I'll give both suggested methods a trial just for the coding experience.
As an aside, in VBA it was necessary to explicitly check the value of a
boolean variable 'If myBool = True Then...'. This is because there can be
the occasional problem encounted if you used 'If myBool Then...', it's a
VBA thing. Any such problems with VB.NET?
Regards
Terry
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message
news:9N******************************@comcast.com. ..
>On 2007-01-12, Terry <ne*******@whiteHYPHENlightDOTme.ukwrote:
>>I am getting the following warning for the below function. I understand what it means but how do I handle a null reference? Then how do I pass the resulting value?
Regards Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. G:\Project Development\Visual Studio 2005\Projects\Ascension\Ascension\SwephConversio ns.vb 64 3 Ascension
' Convert decimal hours to hours/minutes/seconds
Public Function Dec2hms(ByVal x As Decimal) As String
Dim hh As Int32, mm As Int32, ss As Decimal, remainder As Decimal
'Dim x a decimal, hh as integer
hh = CType(x, Integer)
remainder = (x - hh)
mm = CType((remainder * 60), Integer)
remainder = ((remainder * 60) - mm)
ss = Int(remainder * 60)
remainder = ((remainder * 60) - ss)
If remainder >= 0.5 Then
ss = ss + 1
Else
ss = ss
End If
hms = hh & "h " & mm & "m " & ss & "s"
End Function
The problem is that you are not returning a value at all that I can see. Which means that the value of the function will always be a null reference. There are two, ways to return a value from a function in vb.net. One, is the same as the old vb way - and that is to assign the value to the function name:
Public Function Dec2hms As String ....
Dec2hms = hh & "h " & mm & "m " & ss & "s" End Function
The other, prefered way is to use the Return statment:
Public Function Dec2hms As String ....
Return hh & "h " & mm & "m " & ss & "s" End Function
Now, to avoid these kind of warnings, you just need to make sure that there is a return along all normal code paths.... I personally like to structure code so that there is only one exit point, so that often leads to code that looks something like:
Public Function SomeFunc As Boolean ' i chose to default to a failure, but that ' can change based on what is easier and makes ' more sense for the method Dim success As Boolean = False
' do cool stuff that might change the value of success
Return success
End Function
HTH,
-- Tom Shelton
FYI - Option Explicit is already on, by default in VB .NET. But, yes do
turn Option Strict on to make VS.NET force you to write more bullet-proof
code.
"Stephany Young" <noone@localhostwrote in message
news:uC**************@TK2MSFTNGP02.phx.gbl...
The 'VBA thing' as you put it was primarily caused by the use of the
variant data type.
I recommend that, in ALL your VB.NET projects, you set Option Explicit and
Option Strict. Doing so will highlight places where such a problem is
likely to occur.
If you code:
Dim myBool As Boolean
If myBool Then
...
End If
then you won't run into that problem.
FYI and in case you want to upset me in the future, I'm a 'her', not a
'his'. ;)
"Terry" <it@REMOVETHISfloydautomatic.co.ukwrote in message
news:uj**************@TK2MSFTNGP06.phx.gbl...
>Thanks Tom,
Good points. I will use the Return statement for the reasons given by Stephany in his post, but setting an initial value for the Return may be advantageous and less code lines. In your example setting success=False (fail) is similar to how I checked for successful table updates in VBA, True would mean there were no errors and Commit, False caused a Rollback. In my function I'll set hms as empty.
I'll give both suggested methods a trial just for the coding experience.
As an aside, in VBA it was necessary to explicitly check the value of a boolean variable 'If myBool = True Then...'. This is because there can be the occasional problem encounted if you used 'If myBool Then...', it's a VBA thing. Any such problems with VB.NET?
Regards Terry
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message news:9N******************************@comcast.com ...
>>On 2007-01-12, Terry <ne*******@whiteHYPHENlightDOTme.ukwrote: I am getting the following warning for the below function. I understand what it means but how do I handle a null reference? Then how do I pass the resulting value?
Regards Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. G:\Project Development\Visual Studio 2005\Projects\Ascension\Ascension\SwephConversi ons.vb 64 3 Ascension
' Convert decimal hours to hours/minutes/seconds
Public Function Dec2hms(ByVal x As Decimal) As String
Dim hh As Int32, mm As Int32, ss As Decimal, remainder As Decimal
'Dim x a decimal, hh as integer
hh = CType(x, Integer)
remainder = (x - hh)
mm = CType((remainder * 60), Integer)
remainder = ((remainder * 60) - mm)
ss = Int(remainder * 60)
remainder = ((remainder * 60) - ss)
If remainder >= 0.5 Then
ss = ss + 1
Else
ss = ss
End If
hms = hh & "h " & mm & "m " & ss & "s"
End Function
The problem is that you are not returning a value at all that I can see. Which means that the value of the function will always be a null reference. There are two, ways to return a value from a function in vb.net. One, is the same as the old vb way - and that is to assign the value to the function name:
Public Function Dec2hms As String ....
Dec2hms = hh & "h " & mm & "m " & ss & "s" End Function
The other, prefered way is to use the Return statment:
Public Function Dec2hms As String ....
Return hh & "h " & mm & "m " & ss & "s" End Function
Now, to avoid these kind of warnings, you just need to make sure that there is a return along all normal code paths.... I personally like to structure code so that there is only one exit point, so that often leads to code that looks something like:
Public Function SomeFunc As Boolean ' i chose to default to a failure, but that ' can change based on what is easier and makes ' more sense for the method Dim success As Boolean = False
' do cool stuff that might change the value of success
Return success
End Function
HTH,
-- Tom Shelton
Sorry about that Stephany, should have guessed. Thanks for the help, and
slapped wrist :-)
Regards
Terry
"Stephany Young" <noone@localhostwrote in message
news:uC**************@TK2MSFTNGP02.phx.gbl...
The 'VBA thing' as you put it was primarily caused by the use of the
variant data type.
I recommend that, in ALL your VB.NET projects, you set Option Explicit and
Option Strict. Doing so will highlight places where such a problem is
likely to occur.
If you code:
Dim myBool As Boolean
If myBool Then
...
End If
then you won't run into that problem.
FYI and in case you want to upset me in the future, I'm a 'her', not a
'his'. ;)
"Terry" <it@REMOVETHISfloydautomatic.co.ukwrote in message
news:uj**************@TK2MSFTNGP06.phx.gbl...
>Thanks Tom,
Good points. I will use the Return statement for the reasons given by Stephany in his post, but setting an initial value for the Return may be advantageous and less code lines. In your example setting success=False (fail) is similar to how I checked for successful table updates in VBA, True would mean there were no errors and Commit, False caused a Rollback. In my function I'll set hms as empty.
I'll give both suggested methods a trial just for the coding experience.
As an aside, in VBA it was necessary to explicitly check the value of a boolean variable 'If myBool = True Then...'. This is because there can be the occasional problem encounted if you used 'If myBool Then...', it's a VBA thing. Any such problems with VB.NET?
Regards Terry
"Tom Shelton" <to*********@comcastXXXXXXX.netwrote in message news:9N******************************@comcast.com ...
>>On 2007-01-12, Terry <ne*******@whiteHYPHENlightDOTme.ukwrote: I am getting the following warning for the below function. I understand what it means but how do I handle a null reference? Then how do I pass the resulting value?
Regards Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. G:\Project Development\Visual Studio 2005\Projects\Ascension\Ascension\SwephConversi ons.vb 64 3 Ascension
' Convert decimal hours to hours/minutes/seconds
Public Function Dec2hms(ByVal x As Decimal) As String
Dim hh As Int32, mm As Int32, ss As Decimal, remainder As Decimal
'Dim x a decimal, hh as integer
hh = CType(x, Integer)
remainder = (x - hh)
mm = CType((remainder * 60), Integer)
remainder = ((remainder * 60) - mm)
ss = Int(remainder * 60)
remainder = ((remainder * 60) - ss)
If remainder >= 0.5 Then
ss = ss + 1
Else
ss = ss
End If
hms = hh & "h " & mm & "m " & ss & "s"
End Function
The problem is that you are not returning a value at all that I can see. Which means that the value of the function will always be a null reference. There are two, ways to return a value from a function in vb.net. One, is the same as the old vb way - and that is to assign the value to the function name:
Public Function Dec2hms As String ....
Dec2hms = hh & "h " & mm & "m " & ss & "s" End Function
The other, prefered way is to use the Return statment:
Public Function Dec2hms As String ....
Return hh & "h " & mm & "m " & ss & "s" End Function
Now, to avoid these kind of warnings, you just need to make sure that there is a return along all normal code paths.... I personally like to structure code so that there is only one exit point, so that often leads to code that looks something like:
Public Function SomeFunc As Boolean ' i chose to default to a failure, but that ' can change based on what is easier and makes ' more sense for the method Dim success As Boolean = False
' do cool stuff that might change the value of success
Return success
End Function
HTH,
-- Tom Shelton
Nick,
There is in my idea a mistakes in your reply to Stephanie.
She is not writing a string *is* a value. She writes a string is *called* a
value type. That is often done, a string acts almost completely as a value
type.
As you wrote is a string is declared it has no reference and Is therefore
Nothing, as soon however that it is used in an operation it get a value and
= than Nothing. This standard assignment is only with strings.
Cor
"Nick Hall" <ni***@aslan.nospam.co.ukschreef in bericht
news:eM*************@TK2MSFTNGP04.phx.gbl...
Great summary; however there are a couple of mistakes in what you say
which I should point out.
"Stephany Young" <noone@localhostwrote in message
news:en**************@TK2MSFTNGP02.phx.gbl...
>Without going into the why's and wherefore's, some types in .NET are called value types. These include String, Integer, DateTime and Boolean among others. These are usually implemented as a Structure rather than as Class. A type implemented as a Class is usually called a reference type.
String is NOT a value type; it is a reference type. String is what's
called an immutable reference type (once created, the string will never
change value).
>> In general, you can assing Nothing to a variable of a reference type and that variable is considered to be unassigned.
When you assign Nothing to a variable of a value type, then, behind the scenes, the default value for that particular value type is substituted. The default value for a String is String.Empty, the default value for an Integer is 0, the default value for a DateTime is 01/01/0001, the default value for a Boolean is False and so on and so forth.
Because of the above, the default value for an uninitialised string is
Nothing (null reference) not String.Empty. The difference is quite
important, as you will get a NullReferenceException if you attempt to do
anything with a string before it is assigned.
Hope this clarifies,
Nick Hall
I have to disagree Cor. I think it was clear the Stephany was indicating
that a String is a Value Type and, as Tom pointed out, it is not. I don't
know how you could read the statement below and confuse her description as
anything but examples of what value type and reference types are. Also,
given her tone about how important terminology is, I think it was clear she
wasn't being anything esle but direct.
>"Without going into the why's and wherefore's, some types in .NET are called value types. These include String, Integer, DateTime and Boolean among others. These are usually implemented as a Structure rather than as Class. A type implemented as a Class is usually called a reference type."
>"When you assign Nothing to a variable of a value type, then, behind the scenes, the default value for that particular value type is substituted. The default value for a String is String.Empty, the default value for an Integer is 0, the default value for a DateTime is 01/01/0001, the default value for a Boolean is False and so on and so forth"
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Nick,
There is in my idea a mistakes in your reply to Stephanie.
She is not writing a string *is* a value. She writes a string is *called*
a value type. That is often done, a string acts almost completely as a
value type.
As you wrote is a string is declared it has no reference and Is therefore
Nothing, as soon however that it is used in an operation it get a value
and = than Nothing. This standard assignment is only with strings.
Cor
"Nick Hall" <ni***@aslan.nospam.co.ukschreef in bericht
news:eM*************@TK2MSFTNGP04.phx.gbl...
>Great summary; however there are a couple of mistakes in what you say which I should point out.
"Stephany Young" <noone@localhostwrote in message news:en**************@TK2MSFTNGP02.phx.gbl...
>>Without going into the why's and wherefore's, some types in .NET are called value types. These include String, Integer, DateTime and Boolean among others. These are usually implemented as a Structure rather than as Class. A type implemented as a Class is usually called a reference type.
String is NOT a value type; it is a reference type. String is what's called an immutable reference type (once created, the string will never change value).
>>> In general, you can assing Nothing to a variable of a reference type and that variable is considered to be unassigned.
When you assign Nothing to a variable of a value type, then, behind the scenes, the default value for that particular value type is substituted. The default value for a String is String.Empty, the default value for an Integer is 0, the default value for a DateTime is 01/01/0001, the default value for a Boolean is False and so on and so forth.
Because of the above, the default value for an uninitialised string is Nothing (null reference) not String.Empty. The difference is quite important, as you will get a NullReferenceException if you attempt to do anything with a string before it is assigned.
Hope this clarifies,
Nick Hall
Scott,
I am sorry Scott, but in my idea is the main from Stephanie's message true.
I find it an insult to tell that a so long regular as Stephany does not know
that a string is a reference type, therefore I find that she wrote is very
correct measuring what she would write in advance.
Cor
Well, you are certainly entitled to your opinion. I'm not insulting anyone,
I'm just responding to what she wrote. She may have known that a String is
a reference type, but that's not at all what she wrote. And since the OP
may not be aware of Stephany's "regular" contributions to the group (I'm not
sure I recall seeing her messages before either), the OP needs the correct
info.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Scott,
I am sorry Scott, but in my idea is the main from Stephanie's message
true.
I find it an insult to tell that a so long regular as Stephany does not
know that a string is a reference type, therefore I find that she wrote is
very correct measuring what she would write in advance.
Cor
Cor:
Thank you for your concern but I am a big girl and quite capable of sticking
up for myself. Please note that I corrected my mistake about 3.5 hours
before your post.
Scott:
Yes you are correct. I did state that a string is a value type but you will
note that when it was pointed out that I was incorrect I, effectively,
apologised for that mistake (just over 24 hours before your post).
In General:
If anyone is going to have a go at me, please have the courtesy to spell my
name correctly.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Scott,
I am sorry Scott, but in my idea is the main from Stephanie's message
true.
I find it an insult to tell that a so long regular as Stephany does not
know that a string is a reference type, therefore I find that she wrote is
very correct measuring what she would write in advance.
Cor
Scott,
As you all are than so concerned about the correct name for the string,
which in my opinion acts in many cases as a value, why than not for the
DateTime structure which Stephany calls in the same sentence a value (AFAIK
are the string and the datetime both the two exceptions from the standard
rules)?
Cor
"Scott M." <s-***@nospam.nospamschreef in bericht
news:OW**************@TK2MSFTNGP02.phx.gbl...
Well, you are certainly entitled to your opinion. I'm not insulting
anyone, I'm just responding to what she wrote. She may have known that a
String is a reference type, but that's not at all what she wrote. And
since the OP may not be aware of Stephany's "regular" contributions to the
group (I'm not sure I recall seeing her messages before either), the OP
needs the correct info.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Scott,
I am sorry Scott, but in my idea is the main from Stephanie's message true.
I find it an insult to tell that a so long regular as Stephany does not know that a string is a reference type, therefore I find that she wrote is very correct measuring what she would write in advance.
Cor
See my message to Scott .
As extra
For me it is standard to shift the y at the end of names in pluriform mode
to ie, I will try not to do that again for your name, I don't remember me
from what language I have that.
You are probably the last which one who I will help in this newsgroup.
Moreover, I can not put one character in a message or there comes a scary
comment from you.
If I reference in a thread to you, than I do that to make the explanation
easier.
Cor
..
"Stephany Young" <noone@localhostschreef in bericht
news:%2****************@TK2MSFTNGP03.phx.gbl...
Cor:
Thank you for your concern but I am a big girl and quite capable of
sticking up for myself. Please note that I corrected my mistake about 3.5
hours before your post.
Scott:
Yes you are correct. I did state that a string is a value type but you
will note that when it was pointed out that I was incorrect I,
effectively, apologised for that mistake (just over 24 hours before your
post).
In General:
If anyone is going to have a go at me, please have the courtesy to spell
my name correctly.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Scott,
I am sorry Scott, but in my idea is the main from Stephanie's message true.
I find it an insult to tell that a so long regular as Stephany does not know that a string is a reference type, therefore I find that she wrote is very correct measuring what she would write in advance.
Cor
System.DateTime is definitely a value type. That is because it is derived
from System.ValueType.
System.String is definitely NOT a value type. That is because it is NOT
derived from System.ValueType. Instead, it is derived directly from
System.Object.
For those who might be interested there is a fairly extensive of types that
are value type in the documentation. This can be found by locating
System.ValueType and then clicking on the Derived Classes link on that page.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Scott,
As you all are than so concerned about the correct name for the string,
which in my opinion acts in many cases as a value, why than not for the
DateTime structure which Stephany calls in the same sentence a value
(AFAIK are the string and the datetime both the two exceptions from the
standard rules)?
Cor
"Scott M." <s-***@nospam.nospamschreef in bericht
news:OW**************@TK2MSFTNGP02.phx.gbl...
>Well, you are certainly entitled to your opinion. I'm not insulting anyone, I'm just responding to what she wrote. She may have known that a String is a reference type, but that's not at all what she wrote. And since the OP may not be aware of Stephany's "regular" contributions to the group (I'm not sure I recall seeing her messages before either), the OP needs the correct info.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Scott,
I am sorry Scott, but in my idea is the main from Stephanie's message true.
I find it an insult to tell that a so long regular as Stephany does not know that a string is a reference type, therefore I find that she wrote is very correct measuring what she would write in advance.
Cor
Stephany
I did not say that string is a value type. I only am telling that it is not
acting like every other reference type.
Therefore I agree with your message because of this statement you wrote.
>When you assign Nothing to a variable of a value type, then, behind the scenes, the default value for that particular value type is substituted. The default value for a String is String.Empty, the default value for an Integer is 0, the default value for a DateTime is 01/01/0001, the default value for Boolean is False and so on and so forth.
This is true,
dim a as string
a = nothing
result a is string.Empty
This is not for a standard reference type. And because that you wrote before
that:
>Without going into the why's and wherefore's, some types in .NET are called value types.
Is for me the message about the default values more important the the
complete syntactical truth of it.
However, I was probably expecting more methodical thought in the message
than there really was.
I hope that this declares as well the discussion for the OP.
Cor
It has
"Stephany Young" <noone@localhostschreef in bericht
news:uC**************@TK2MSFTNGP02.phx.gbl...
System.DateTime is definitely a value type. That is because it is derived
from System.ValueType.
System.String is definitely NOT a value type. That is because it is NOT
derived from System.ValueType. Instead, it is derived directly from
System.Object.
For those who might be interested there is a fairly extensive of types
that are value type in the documentation. This can be found by locating
System.ValueType and then clicking on the Derived Classes link on that
page.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Scott,
As you all are than so concerned about the correct name for the string, which in my opinion acts in many cases as a value, why than not for the DateTime structure which Stephany calls in the same sentence a value (AFAIK are the string and the datetime both the two exceptions from the standard rules)?
Cor
"Scott M." <s-***@nospam.nospamschreef in bericht news:OW**************@TK2MSFTNGP02.phx.gbl...
>>Well, you are certainly entitled to your opinion. I'm not insulting anyone, I'm just responding to what she wrote. She may have known that a String is a reference type, but that's not at all what she wrote. And since the OP may not be aware of Stephany's "regular" contributions to the group (I'm not sure I recall seeing her messages before either), the OP needs the correct info.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message news:%2****************@TK2MSFTNGP06.phx.gbl.. . Scott,
I am sorry Scott, but in my idea is the main from Stephanie's message true.
I find it an insult to tell that a so long regular as Stephany does not know that a string is a reference type, therefore I find that she wrote is very correct measuring what she would write in advance.
Cor
Cor,
DateTimes are Value Types, not reference types like Strings. Of all the
primitive .NET types, only Strings and Objects are reference types. All
others are value types.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Scott,
As you all are than so concerned about the correct name for the string,
which in my opinion acts in many cases as a value, why than not for the
DateTime structure which Stephany calls in the same sentence a value
(AFAIK are the string and the datetime both the two exceptions from the
standard rules)?
Cor
"Scott M." <s-***@nospam.nospamschreef in bericht
news:OW**************@TK2MSFTNGP02.phx.gbl...
>Well, you are certainly entitled to your opinion. I'm not insulting anyone, I'm just responding to what she wrote. She may have known that a String is a reference type, but that's not at all what she wrote. And since the OP may not be aware of Stephany's "regular" contributions to the group (I'm not sure I recall seeing her messages before either), the OP needs the correct info.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Scott,
I am sorry Scott, but in my idea is the main from Stephanie's message true.
I find it an insult to tell that a so long regular as Stephany does not know that a string is a reference type, therefore I find that she wrote is very correct measuring what she would write in advance.
Cor
Stephany,
I was responding to Cor, not you. I never said that you hadn't spotted your
mistake, nor did I imply that you didn't know that Strings were reference
types. I was simply responding to Cor, when he said that he believed that
you were not actually saying (originally) that Strings were value types. He
and I have been discussing your first post about Strings and value types,
not the corrected post(s) after that.
"Stephany Young" <noone@localhostwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Cor:
Thank you for your concern but I am a big girl and quite capable of
sticking up for myself. Please note that I corrected my mistake about 3.5
hours before your post.
Scott:
Yes you are correct. I did state that a string is a value type but you
will note that when it was pointed out that I was incorrect I,
effectively, apologised for that mistake (just over 24 hours before your
post).
In General:
If anyone is going to have a go at me, please have the courtesy to spell
my name correctly.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Scott,
I am sorry Scott, but in my idea is the main from Stephanie's message true.
I find it an insult to tell that a so long regular as Stephany does not know that a string is a reference type, therefore I find that she wrote is very correct measuring what she would write in advance.
Cor
Cor,
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
I did not say that string is a value type. I only am telling that it is
not acting like every other reference type.
Therefore I agree with your message because of this statement you wrote.
>>When you assign Nothing to a variable of a value type, then, behind the scenes, the default value for that particular value type is substituted. The default value for a String is String.Empty, the default value for an Integer is 0, the default value for a DateTime is 01/01/0001, the default value for Boolean is False and so on and so forth.
This is true,
dim a as string
a = nothing
result a is string.Empty
'a Is String.Empty' evaluates to 'False' and string variables are
initialized to the 'Nothing' reference by default, not 'String.Empty'!
'String' has typical reference-type behavior here.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Herfried,
'a Is String.Empty' evaluates to 'False' and string variables are
initialized to the 'Nothing' reference by default, not 'String.Empty'!
'String' has typical reference-type behavior here.
What do you want to say, do you mean that you have investigated today and
learned that today. I suppose not, otherwise I can sent you by mail what I
find about your message.
I know this already for a long time. Armin and Jay have had to many
discussions about this subject that I am not able to forget this. I am glad
that you know it now as well. Have a look at Interent with search keys
String Armin and Jay you can learn than a lot more
I had not the idea about that I did write that somewhere. You can call my
message about the datetime a mistake from me, that Stephany correctly
replied.
Cor
"Herfried K. Wagner [MVP]" <hi***************@gmx.atschreef in bericht
news:eE**************@TK2MSFTNGP04.phx.gbl...
Cor,
"Cor Ligthert [MVP]" <no************@planet.nlschrieb:
>I did not say that string is a value type. I only am telling that it is not acting like every other reference type.
Therefore I agree with your message because of this statement you wrote.
>>>When you assign Nothing to a variable of a value type, then, behind the scenes, the default value for that particular value type is substituted. The default value for a String is String.Empty, the default value for an Integer is 0, the default value for a DateTime is 01/01/0001, the default value for Boolean is False and so on and so forth.
This is true, dim a as string a = nothing result a is string.Empty
'a Is String.Empty' evaluates to 'False' and string variables are
initialized to the 'Nothing' reference by default, not 'String.Empty'!
'String' has typical reference-type behavior here.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
I certainly prompted a debate.
Going back to my copy of .NET Framework 2.0 App Dev Foundation Training Kit,
I find that under the list of 'Other value Types' there is System.DateTime,
whilst under 'Common Reference Types' is listed System.String.
I do understand the common pitfalls that a newcomer to .NET may make in
handling text data.
All of the replying posts have been interesting and of value, I shall keep
the 'watched' flag on them all so that I can reference them from time to
time :-)
All your help has now enabled me to get my conversion of a VBA project to
VB.NET started and already producing results, many thanks.
Regards
Terry
"Terry" <ne*******@whiteHYPHENlightDOTme.ukwrote in message
news:uQ**************@TK2MSFTNGP02.phx.gbl...
>I am getting the following warning for the below function. I understand what it means but how do I handle a null reference? Then how do I pass the resulting value?
Regards
Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A
null reference exception could occur at run time when the result is used.
G:\Project Development\Visual Studio
2005\Projects\Ascension\Ascension\SwephConversions .vb 64 3 Ascension
' Convert decimal hours to hours/minutes/seconds
Public Function Dec2hms(ByVal x As Decimal) As String
Dim hh As Int32, mm As Int32, ss As Decimal, remainder As Decimal
'Dim x a decimal, hh as integer
hh = CType(x, Integer)
remainder = (x - hh)
mm = CType((remainder * 60), Integer)
remainder = ((remainder * 60) - mm)
ss = Int(remainder * 60)
remainder = ((remainder * 60) - ss)
If remainder >= 0.5 Then
ss = ss + 1
Else
ss = ss
End If
hms = hh & "h " & mm & "m " & ss & "s"
End Function
I'm glad you got something out of our little scrap :)
It's not just the 'newcomer' who can fall into the various traps. We
'old-hands' can still fall into them just as easily, usually with much
tearing of hair and gnashing of teeth.
Don't be 'scared off' from posting queries that you might have from time to
time.
"Terry" <ne******@whiteHYPHENlightDOTme.ukwrote in message
news:eU**************@TK2MSFTNGP03.phx.gbl...
>I certainly prompted a debate.
Going back to my copy of .NET Framework 2.0 App Dev Foundation Training
Kit, I find that under the list of 'Other value Types' there is
System.DateTime, whilst under 'Common Reference Types' is listed
System.String.
I do understand the common pitfalls that a newcomer to .NET may make in
handling text data.
All of the replying posts have been interesting and of value, I shall keep
the 'watched' flag on them all so that I can reference them from time to
time :-)
All your help has now enabled me to get my conversion of a VBA project to
VB.NET started and already producing results, many thanks.
Regards
Terry
"Terry" <ne*******@whiteHYPHENlightDOTme.ukwrote in message
news:uQ**************@TK2MSFTNGP02.phx.gbl...
>>I am getting the following warning for the below function. I understand what it means but how do I handle a null reference? Then how do I pass the resulting value?
Regards Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. G:\Project Development\Visual Studio 2005\Projects\Ascension\Ascension\SwephConversion s.vb 64 3 Ascension
' Convert decimal hours to hours/minutes/seconds
Public Function Dec2hms(ByVal x As Decimal) As String
Dim hh As Int32, mm As Int32, ss As Decimal, remainder As Decimal
'Dim x a decimal, hh as integer
hh = CType(x, Integer)
remainder = (x - hh)
mm = CType((remainder * 60), Integer)
remainder = ((remainder * 60) - mm)
ss = Int(remainder * 60)
remainder = ((remainder * 60) - ss)
If remainder >= 0.5 Then
ss = ss + 1
Else
ss = ss
End If
hms = hh & "h " & mm & "m " & ss & "s"
End Function
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Penn Markham |
last post by:
Hello all,
I am writing a script where I need to use the system() function to call
htpasswd. I can do this just fine on the command line...works great
(see attached file, test.php). When my...
|
by: Vin |
last post by:
Is it possible to access a function defined in python shell from c-code?
For example if I have defined
>>> def c(x):
.... return x*x
....
and defined in some module foo
|
by: lutorm |
last post by:
Hi,
I'm having a problem with a return statement being parsed to return a
function (I think). Check here:
template <typename T> class A {};
template <typename T> class maker_of_A {
public:...
|
by: Marco Loskamp |
last post by:
Dear list,
I'm trying to dynamically generate functions; it seems that what I
really want is beyond C itself, but I'd like to be confirmed here.
In the minimal example below, I'd like to...
|
by: collinm |
last post by:
hi
i got some error with parameter
my searchFile function:
char *tmp;
int size;
....
|
by: orekinbck |
last post by:
Hi There
I am learning about reflection so apologies if this post is vague ...
I am doing some unit testing and have written a function that accepts
two objects and tests to see if their...
|
by: comp.lang.tcl |
last post by:
I wrote this PHP function in the hopes that it would properly use a TCL
proc I wrote about 4 years ago:
if (!function_exists('proper_case')) {
/**
* Ths function will convert a string into a...
|
by: svata |
last post by:
Hello there,
after some time of pondering I come to some solution which would suit
me best. Please correct, if I am wrong.
Function has two parameters. A string array, better said a pointer to...
|
by: Nickolay Ponomarev |
last post by:
Hi,
Why does http://www.jibbering.com/faq/ uses new Function constructor
instead of function expressions (function(...) { ... }) when defining
new functions? E.g. for LTrim and toFixed. Is the...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
| |