Search Results

Search: Posts Made By: JohnGraham
Forum: Programming 03-06-2014
27,809
Posted By JohnGraham
You're thinking of configure scripts - they take...
You're thinking of configure scripts - they take a --prefix argument, makefiles don't.



Order of arguments with "make val=arg" doesn't matter either, and I don't know what you mean by the...
Forum: Programming 03-06-2014
27,809
Posted By JohnGraham
Use makefile variables - they $(look_like_this) -...
Use makefile variables - they $(look_like_this) - and pass them as environment variables on the command line, e.g.:


$ cat makefile
speak:
echo $(PHRASE)
$ make speak PHRASE=hi
echo hi...
Forum: Programming 02-16-2014
897
Posted By JohnGraham
The problem is that: *i--; decrements...
The problem is that:

*i--;

decrements the pointer, not the pointed-to value. I.e. it's equivalent to:


*(i--);


What you really want is:


(*i)--;


(On my machine at least, your...
Forum: Programming 07-04-2013
11,095
Posted By JohnGraham
select()/poll() are for monitoring multiple file...
select()/poll() are for monitoring multiple file descriptors for activity - the code you posted only handles one file descriptor, so they will not help you.

Apart from that, it very much depends...
Forum: Programming 07-01-2013
3,804
Posted By JohnGraham
Of course - d'oh! Apologies if anyone was...
Of course - d'oh! Apologies if anyone was confused...
Forum: Programming 06-29-2013
3,804
Posted By JohnGraham
Kind of, but you seem to just be checking for a...
Kind of, but you seem to just be checking for a specific error. Generally for *NIX system calls:


The return value tells you whether there was an error or not, and
errno tells you the specific...
Forum: Programming 04-05-2013
4,956
Posted By JohnGraham
You're trying to make a template specialization,...
You're trying to make a template specialization, which means you need to use a concrete type instead of the generic T. So you could do e.g.:


template<> int* AddFun<int*>(int* i, int* j) {
...
Forum: Programming 02-06-2013
3,153
Posted By JohnGraham
`--target' is for cross-compilers - you want to...
`--target' is for cross-compilers - you want to use `--host' instead.

If that doesn't work, try using the output of `arm-elf-gcc -dumpmachine' instead of `arm-elf' (assuming your cross-toolchain...
Forum: Programming 01-31-2013
6,315
Posted By JohnGraham
Okay, you first need to assess whether or not the...
Okay, you first need to assess whether or not the mysql query went OK or not. Either "set -e" at the start of the script or deal with it when you run the query.

My MySQL is rusty but I checked and...
Forum: Programming 01-30-2013
6,315
Posted By JohnGraham
The first thing I notice is that you do "while [...
The first thing I notice is that you do "while [ $result ]", but haven't set $result anywhere - is this present in your environment?

Also, the body of the while[$result] doesn't modify $result, so...
Forum: Programming 01-29-2013
3,382
Posted By JohnGraham
The man page tells you that the result may be in...
The man page tells you that the result may be in a static buffer. It tells you this to let you know two things:


You do not need to free the result returned from this function. A static buffer...
Forum: Programming 01-28-2013
3,382
Posted By JohnGraham
Where exactly the string is stored is...
Where exactly the string is stored is implementation-defined and shouldn't matter to you as an application developer.

sys_errlist is in stdio.h (see 'man sys_errlist'). It is initialized before...
Forum: Programming 12-17-2012
2,177
Posted By JohnGraham
Or you can use the GNU-specific...
Or you can use the GNU-specific pthread_setaffinity_np() to set CPU affinities on a per-thread basis.
Forum: Programming 12-15-2012
1,541
Posted By JohnGraham
Use: ifs_modl.open(val_ifmodl.c_str());
Use:


ifs_modl.open(val_ifmodl.c_str());
Forum: Programming 12-10-2012
35,441
Posted By JohnGraham
Yes, you can - C++ doesn't mandate that you use a...
Yes, you can - C++ doesn't mandate that you use a newline in this case. However, I find that much harder to read than with a newline and proper spacing, e.g.:


for (int i = 0; i < NL; i++)
...
Forum: Programming 12-07-2012
2,372
Posted By JohnGraham
Wish granted: Your mildly cryptic and...
Wish granted: Your mildly cryptic and explanation-devoid statement simply compels me to ask, what part of the above do you think may be associated with undefined behaviour?

I have to say, posting...
Forum: Programming 11-29-2012
2,135
Posted By JohnGraham
According to the GCC documentation...
According to the GCC documentation (http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Other-Builtins.html). It could be wrong/omitting some thing though.
Forum: Programming 11-28-2012
2,135
Posted By JohnGraham
Also, if you're using GCC, printf() is a built-in...
Also, if you're using GCC, printf() is a built-in function - though you should get a warning about "incompatible declaration of built-in function printf()" or similar, since your use of the function...
Forum: Programming 11-22-2012
1,121
Posted By JohnGraham
Change your function from returning a Verbosity&...
Change your function from returning a Verbosity& (i.e. a reference to a Verbosity) to returning a Verbosity.
Forum: Programming 11-01-2012
925
Posted By JohnGraham
For what it's worth, you can do it in C with: ...
For what it's worth, you can do it in C with:


float a, b;
if (sscanf(s, " %f %f", &a, &b) != 2)
printf("Error\n");
else
printf("Values are %f and %f\n", a, b);
Forum: Programming 11-01-2012
925
Posted By JohnGraham
When you find solutions to your own problems,...
When you find solutions to your own problems, please post them (even if it's just a link to a web page that tells you what you want) so others googling in the future aren't left hanging.

I assume...
Forum: Programming 10-18-2012
3,165
Posted By JohnGraham
When a number starts with a leading "0", it's...
When a number starts with a leading "0", it's interpreted as an octal number, which can only use digits 0-7 (inclusive). Fix this, recompile and see what the output is.

Also, do you know that...
Forum: Programming 10-17-2012
1,090
Posted By JohnGraham
I like Thinking in Java. IIRC non-current...
I like Thinking in Java. IIRC non-current versions are available for free off t'internet.
Forum: Programming 10-16-2012
2,144
Posted By JohnGraham
They could - it's just a matter of style. Using...
They could - it's just a matter of style. Using '(1 << 3)' makes it explicitly clear that what you're dealing with a bit. They both mean the same thing to the compiler, it's just what they signal to...
Forum: Programming 10-13-2012
1,937
Posted By JohnGraham
See the man pages for opendir() and readdir().
See the man pages for opendir() and readdir().
Showing results 1 to 25 of 126

 
All times are GMT -4. The time now is 07:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy