Forgot your password?
Sign in with
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View PHP questions
View Python questions
All Message Boards...
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Design and Architecture
Internet of Things
C / C++ / MFC
ATL / WTL / STL
Objective-C and Swift
Hardware & Devices
Hosting and Servers
.NET (Core and Framework)
Site Bugs / Suggestions
Spam and Abuse Watch
The Insider Newsletter
The Daily Build Newsletter
Most Valuable Professionals
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
What is 'CodeProject'?
Ask a Question
Bugs and Suggestions
Article Help Forum
Comments by Klaus-Werner Konrad (Top 19 by date)
"A decent compiler would produce a warning"
NO !!! printf is a function with a variable Count of Arguments, so a Compiler can never know how many Arguments are right ...
Looks for me like an (incomlete) implementation of a binary tree ...
is CLEARLY a literal, not an command line argument
This would pretty sure lead to a Memory Access Violation; the Argument from main() is a string LITERAL ...
This will not work, because in C you can use Switch only with integral types, and a string in C is an ARRAY of characters ...
Should give at least a warning message: function 'message' has no return value
Umm ... now I'm stunned
- C has no exception mechanism
- all possible values MUST be allowed, 'cause they are valid
what are the opportunities in your mind ?
(Remember, we're talking about pure C...
"But it still leaves not 100% what to do it there are some digits, but parsing still fails due to invalid Format"
Well - the link I submitted states:
"If an underflow occurs, strtol() returns LONG_MIN. If an overflow occurs, strtol() returns LONG_MAX. In both cases, errno is set to ERANGE"
If the format is invalid, there is nothing to convert - dot
"Anyway, thank you for all your comments" - I always enjoy a Logical conversion - thanks to you !
"I don't question your knowledge" - Very Kind; with 30+ years of C experience from my side everything else would make me really wonder :-)
- first, it's deprecated
- second, check the link (yes, Linux again) http://linux.die.net/man/3/atoi
where is clearly stated: "The behavior is the same as
strtol(nptr, NULL, 10); except that atoi() does not detect Errors"
Ok, it's a Little bit lame, but you should consider that all this functions are NOT C++ library but C library, and that is optimized for Speed. The standard library functions just assumes that you checked for pitfalls beforehand, and you should remember in this context, that C by itself is nothing more than the lowest possible level procedural language (aka high level ASM), aside from FORTH ...
Well - for me it wasn't obvious, 'cause you never mentioned the link ...
If I come accross such a question, I Google first and follow multiple links. In this case, the third reference led to http://linux.die.net/man/3/strtol
and there it states
"If endptr is not NULL, strtol() stores the address of the first invalid character in *endptr. If there were no digits at all, strtol() stores the original value of nptr in *endptr (and returns 0)."
So, IMHO it's not the function that's lame, but the docuzmentation from the original link's site.
Well - it returns an integer value, so to not exclude any possible value in the range there is no possibility to return an error value.
You haven't said WHY you think it's lame - THAT was my question ...
Hi Sergey, I don't know exactly why you think it's lame, 'cause it is from the standard C library, and C don't know exceptions.
The only other passibility would be a additional pointer to the result so the function could return TRUE or FALSE
"0" will give you an other value in *endptr (*endptr == (ptr+1)) than "trash" (*endptr==ptr)
Reason for my vote of 2 \n Overly complicated, no use of TCHAR !
No need to become so rude ...
Yes, I understand the elementary things, and - to repeat it - NO, the VTM is NOT an object,
It's right, the VTM itself is (mostly) implemented as an Array of function pointers, per class; nevertheless it's not an object, but a class member.
What I missed from your original Explanation was the fact, that every OBJECT (class instance) need a own pointer to this table; otherwise polumorphism wouldn't be possible.
SA wrote: "Virtual method table is actually an object, one per type (class/structure)."
That's really wrong !
The VMT is a hidden MEMBER of an OBJECT, i.e. it exists ONE PER OBJECT INSTANCE !!!
Ok - YOU should THINK FIRST and THEN ask a question.
And, if someone requests more information about the subject, you should answer that request, so we are able to help you ...
You ask in C++ forum and say 'How can I do it in Visual Basic'.
You say 'I have only 2 (two) values, and you say 'binary values'.
NOW you talk about a collection of strings; that's something complete different.
So, please, try to describe what you really want to achieve, and specify the language you want to use for it
Worse - he wants to compress 2 bytes to 2 bits, so there are 65,532 other possible values :-)
This is nonsense - an index is only used based on the WHERE-clause, maybe the ORDER BY / GROUP BY clause, but NEVER EVER (except if all columns to deliver in the index) on the content that is to be selected, but it would be really unusual to have an index that spans all table columns !
Last Updated 1 Jan 1900
All Rights Reserved.