« first day (104 days earlier)      last day (789 days later) » 

4:52 AM
0
Q: Memory leak on calling API using sharedInstance resulting in crashin IOS

PavitraI created a sharedInstance with the code below: + (MyClass *)sharedStore { @synchronized(self) { if (sharedInstance == nil) sharedInstance = [[self alloc] init]; } return sharedInstance; } I have a function in MyClass - (MyCl...

 
 
5 hours later…
9:31 AM
0
Q: configuration system failed to initialize with unity section

Giu DoI followed this tutorial : http://weblogs.asp.net/gunnarpeipman/archive/2008/04/13/unity-and-singletons.aspx and I have an issue with my app.config (I have a console application project) : configuration system failed to initialize Here is my app.config : <?xml version="1.0" encoding="utf-8" ?

 
 
6 hours later…
3:14 PM
-1
Q: Singleton functions IOS

djcjA perhaps basic question regarding a singleton class which I want to have as a "dataController" I have based most of the singleton implementation on the banans thread: Using a singleton to create an array accessible by multiple views I am wondering about functions in the singleton class. Befo...

 
3:35 PM
0
Q: Why a static singleton is a simple and elegant solution to avoid 'DCL'?

znlyjWhen need a singleton, is a static field a elegant solution? class HelperSingleton { static Helper singleton = new Helper(); public static Helper getInstance() { return singleton; } } When two threads access to getInstance at the same time, is there a chance the field single...

 
 
6 hours later…
9:28 PM
@FredOverflow A side-effect located between two sequence points (typically ;, but may also be &&, ||, , (not the parameter list delimiter), '?' in 'x ? true : false' and others may be performed at any point between the sequence point. That is, an implementation may delay updating a variable, or may update it prior to when it would otherwise be expected. Hence the reason for this question.
 
@undefinedbehaviour ...Why are you telling me this?
 
user142019
room topic changed to Java Sucks: Suffocating under singletons. [bad-languages] [c] [java] [singletonfactorymanager] [too-many-comments] [uml]
 
@FredOverflow: You asked...
 
@undefinedbehaviour When and where?
 
Oh. You were asking something else...
 
9:32 PM
What was I asking?
 
Well, in that case, the answer is: I wasn't serious. I don't think you have a reason to hate me, yet. :þ
 
Oh, now I get it. I hate undefined behavior, and that is your name.
 
While we're talking about C, though... If I were to tell you your arrays decay, would you think that's a good/normal thing?
 
I really didn't make the connection until now.
@undefinedbehaviour I think array decay is one of the stupidest implicit conversion rules ever conceived.
I don't want vectors to decay to iterators. Why would I want arrays to decay to pointers?
 
I don't particularly care about the conversion. I think it could have been done better, but I'm certainly not fond of the term "decay" used to describe it.
 
9:36 PM
Is that an official term?
 
It seems to imply an aura of decomposition/rotting.
No.
The official term is conversion.
 
@undefinedbehaviour Well, the size information rots away :)
 
... and then magically unrots?
"Ohh nooo, I passed it to a function. It's rotten!" "Ohh, wait. That function has returned. It's consumable again. Yay!" -bogarts-
 
good point
In that sense, it's only a scoped decay :)
 
I'm not sure whether it's any stupider that when you take the address of an array, you get a pointer to an array N of T, where N is the number of items and T is the type... A declaration to store such a pointer would be written like: T (*ptr_to_array)[N];
 
9:43 PM
If you have a T and you take its address, you get a pointer to a T. How is that strange?
 
Size information can't be implicitly passed to a function, yet it can be bound to a variable? Hmmm...
 
Of course the C declarator syntax sucks major ass, but that's C for you.
@undefinedbehaviour Of course it can, just write void foo(int(*p)[10]) if you want an array of 10 ints :)
 
This leads to some awkward constructs where an array won't decay, but can be referred to in other functions with it's size information in tact... Aren't there cleaner ways?
 
Yes. Use vectors.
 
That's not the array. That's a pointer to the array.
You have to dereference it before you use it as an array: (*p)[3] = 11;
 
9:45 PM
So you want to pass the array by value? Nest it in a struct.
 
By value? No. By reference, in this case, but with size information.
 
template<size_t N> void foo(int(&a)[N]);
 
C++ allows some much cleaner solutions, yes.
 
void foo(int * p, int n)
{
    printf("passed %d elements\n", n);
}

#define SIZED(arr) (arr), (sizeof(arr)/sizeof 0[arr])

int main()
{
    int a[10];
    foo(SIZED(a));
    return 0;
}
@undefinedbehaviour C solution :D
 
I'm particularly fond of lambda expressions. I'd have loved to see them in C... but I guess I'll have to migrate to very awkward C#.
lol. I do that with printf format specifiers and arguments, on occasions.
printf(NODE_FORMAT_STRING, NODE_FORMAT(node)); etc...
 
user142019
9:54 PM
@undefinedbehaviour Use Clang.
 
user142019
Clang has lambdas in C as a language extension.
 
That'd be a violation of my portability attitude.
Well, s/my/adopted from comp.lang.c/
 
@rightfold Does it also have Monads for C?
 
user142019
@FredOverflow No, but you can implement them.
 
It's not really C, though.
It's an extension.
"Some of us tend to be pretty paranoid about those nifty-keen but utterly nonstandard vendor extensions, too, because the more enticing and compelling they are, the easier it is for them to be twisted by the vendor into a shackle that forces you to keep using that vendor after they've incongruously become Totally Evil, and you find you'd rather wean yourself from them after all, except now you can't."
Eh, you guys know what you're doing...
So, I was looking up anonymous functions in Java...
... and it doesn't have them, unless you bind them to an anonymous class... Am I right?
 
10:24 PM
z1=malloc(n*sizeof(cplx));
z2=malloc(n*sizeof(cplx));
s=malloc(n*sizeof(cplx));
diff=malloc(n*sizeof(cplx));
if ( z1==NULL || z2==NULL || s==NULL || diff==NULL)
{
    printf("Allocation failed.\nEnding program.");
    exit(0);
}
 
user1596138
10:36 PM
!!/insult
 
10:46 PM
True, this.
 

« first day (104 days earlier)      last day (789 days later) »