Questions tagged [weak]
128 questions
2
votes
2 answers
Trouble using scriptedmain in MinGW
I want to reproduce this Perl code in C, bundling API and CLI in the same C source code file (scriptedmain). This is done in Python with if __name__=="__main__": main() and in gcc/Unix, this looks like:
$ gcc -o scriptedmain scriptedmain.c…

mcandre
- 22,868
- 20
- 88
- 147
2
votes
3 answers
Setting WEAK to a non @property variable
Will need someone with knowledge of ARC to help me.
Basically, I have declared some variables as such in my class
@interface Class{
NSString* one;
NSString* two;
}
@property(nonatomic,weak) NSString* one;
As you can see, I can set the weak…

raaj
- 2,869
- 4
- 38
- 58
2
votes
1 answer
Does the DUKPT algorithm generate weak DES keys?
I'm using the DUKPT algorithm to generate keys for the DES encryption algorithm. The C# implementation of DES throws an exception when you attempt to use a weak key.
Is it possible for the DUKPT algorithm to generate weak keys, or does it avoid…

MjeOsX
- 375
- 4
- 12
1
vote
1 answer
Weak function definitions for interrupt vector in a static library are preferred over strong ones
Introduction
arm-none-eabi-gcc version 10.3-2021.10 20210824
device: nordic nRF52840/nRF52832/nRF52833
library affected: Nordic NRF5 SDK 17.1.0 - custom build system (CMake)
I wrote the CMake build system for Nordic NRF5 SDK (natively it only…

Dino Saric
- 107
- 7
1
vote
0 answers
Disable weak ciphers in Jenkins
Our scan reports show weak cipher enabled for Jenkins. Jenkins is running on windows 2012. The java path is default path in Jenkins.xml .I tried to update the java.security file. It still shows the weak cipher. Not sure if I'm missing anything. Any…

Prasu S
- 11
- 2
1
vote
0 answers
Is this a good practice to creating a weakref cache on python?
I have few classes that get initiated from my database tables.
I am avoiding querying the database if I already have done it before by weak referencing it with it's id in a WeakValueDictionary like so:
import weakref, gc
class anobject():
…

kokoi
- 35
- 1
- 6
1
vote
2 answers
Function inside Function retain cycle
I was wondering how to avoid retain cycle in the following scenario:
private func setupDismissCallbacks() {
// inner func
func dismiss() {
self.videoExporter?.cancel()
self.rootViewController.dismiss(animated: true, completion:…

Roi Mulia
- 5,626
- 11
- 54
- 105
1
vote
1 answer
are there any workaround to specify inner func capture list & their modifier in swift
i searched the swift spec for capture list on inner func but without luck,
is there any way to break these kind of reference cycle?
class Hello {
var name = "name"
var fn: (()->())? = nil
}
func foo() -> Hello? {
var bar: Hello? =…

Minami
- 963
- 6
- 21
1
vote
1 answer
How do I remove a Weak value from a BinaryHeap if it fails to upgrade to a strong reference?
I would like to use a BinaryHeap with elements of type MyWrapperStruct(Weak), where I implement Ord for MyWrapperStruct. In this implementation, I need to upgrade the weak references, which might fail. If they fail, I want the element to…

vandenheuvel
- 349
- 2
- 13
1
vote
1 answer
Swift - Capturing closures - Apple's swift programming guide snippet
In Apple's Swift programming guide, "Automatic Reference Counting" section, at "Resolving Strong Reference Cycles for Closures",
This snippet is mentioned:
lazy var someClosure: () -> String = {
[unowned self, weak delegate = self.delegate!]…

RawKnee
- 324
- 3
- 11
1
vote
0 answers
__attribute__((weak)) for typedefs
With __attribute__((weak)) I can declare a function which will be overridden by a function with the same name, but without __attribute__((weak)) parameter. Is there a way to do something similar with typedefsin C? For example, I would declare a…

Łukasz Przeniosło
- 2,725
- 5
- 38
- 74
1
vote
1 answer
Cannot assign value type mismatch swift
I have the following code snippet.
camera.onDeviceChange = { [weak self] (camera: LLSimpleCamera!, device: AVCaptureDevice!) -> Void in
print("Device changed.")
}
This used to work fine in Swift 2, but now I am getting the following error…

Alk
- 5,215
- 8
- 47
- 116
1
vote
0 answers
Can I store reference on key object from WeakMap value object without preventing GC?
Since GC detects isolated islands of object graph to find candidates for removal from memory and WeakMap does not break island boundaries with it's weak references WeakMap -> KeyObject then it would make sense for this reference WeakMap -> Value ->…

alpav
- 2,972
- 3
- 37
- 47
1
vote
1 answer
Context of self in a method that is called from a closure
A method sampleMethod() is called from a closure with weak reference of self (self?.sampleMethod()), within the same class. What will be the context of self which is now used in sampleMethod()?
Will it be a weak self or a strong one?

Shobhit C
- 828
- 10
- 15
1
vote
1 answer
Weak Refrence in class return nil when created in first class's init
im trying to create weak reference class in another class, in first class's init i create instance of second class to use it in a function, but after init function is done , second class get destroyed and return nil,
here's a example code
//:…

Mohammadalijf
- 1,387
- 9
- 19