Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » access to raw command line parameters
Re: access to raw command line parameters [message #3913 is a reply to message #3912] Sat, 08 July 2006 23:53 Go to previous message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
unodgs wrote on Sat, 08 July 2006 22:32

Werner wrote on Sat, 08 July 2006 16:08


If the above code doesn't help (it doesn't comply with the C++ standard Rolling Eyes )



May I know what's wrong with it??



Sure! You have every right to know! Smile

Here we go:

1.
dr_jumba wrote that he needs to pass the command line arguments to a 3rd party library. It seems much more likely that the "3rd party" expects these arguments to be passed in the standard C++ way than in the Ultimate++ way. Crying or Very Sad

2.
So lets compare the results of your code with what the C++ standard expects:

a)
The first argument (argv[0]) expected by the C++ standard is the (path and) name of the running application. If this is not available the standard expects "argv[0][0] == '\0'".

Your code passes the 1st "real" argument as argv[0]. It suggests itself that this might mislead the receiving library.

b)
The standard expects "argv[argc] == (char* 0)".

I'm not sure whether your code guarantees that and this missing final pointer could terribly crash the library and everything else.

c)
argv itself and the strings to which it points must be modifiable.

You use "const char **argv".

d)
Finally the "application name issue" makes your cnt (= argc) carry a wrong value - 1 too few.

Smile Apologies for this lecture! Smile

Werner
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Web/SSL SSL_CTX_load_verify_locations [FEATURE REQUEST]
Next Topic: cutting the string
Goto Forum:
  


Current Time: Fri Jul 04 18:58:25 CEST 2025

Total time taken to generate the page: 0.03899 seconds