Questions tagged [inout]

90 questions
0
votes
1 answer

How to handle bidirectional pin (inout) in a verilog task

I want to use a bidirectional data bus in my controller.Here's the code module controller ( clk, data_out); // Port Declaration input clk; inout [7:0] data_out; reg [7:0] a; reg [7:0] b; wire [7:0] c; // data should write to…
0
votes
2 answers

Cannot pass immutable value of type 'NSObject' as inout argument

This should work, but I've got no clue why it doesn't. The code is self-explanatory. class Themer { class func applyTheme(_ object: inout NSObject) { //do theming } } And I apply theme to the button like so: class ViewController:…
Aswath
  • 480
  • 3
  • 14
0
votes
1 answer

swift 3 update syntax from swift 2

in swift 2.2 its work: var messages = [JSQMessage]() //... for i in 1...10 { let sender = (i%2 == 0) ? "Server" : self.senderId let messageContent = "Message nr. \(i)" var message = JSQMessage(senderId: sender, displayName: sender, text:…
Denis Windover
  • 324
  • 5
  • 18
0
votes
0 answers

Updating an inout param async does not update reference

Using the below playground, when I print in the async I would assume the counts should be the same, but they are not. It seems that swift does not properly use inout asynchronously, but I need to be able to update an inout reference in an…
0
votes
1 answer

Verilog "In, out, or inout does not appear in port list"

I can't understand what this error means. I want to make a simple calculator with memory, however this error jumped out and I cant get what the ** Error: C:\Users\Kainy\Desktop\LOGIC\calculator\cal.v(14): In, out, or inout does not appear in port…
Kainy Yang
  • 25
  • 1
  • 7
0
votes
1 answer

Swift inout parameter for const properties

Is it possible to use a let property with a similar function parameter to inout when I do't want to change the property itself but that property's properties? e.g. let someLine = CAShapeLayer() func setupLine(inout line:CAShapeLayer, startingPath:…
richy
  • 2,596
  • 1
  • 29
  • 40
0
votes
1 answer

How do you pass a chunk of an array to an inout function? Type-erasure?

I have a function func doThing(inout array: [Int]) { //thing } I have the array var stuff = [0,1,2,3,4,5,6] I want doThing to operate on just the first three elements. doThing(&stuff[0..<3]) doesn't work since var partOfStuff: ArraySlice =…
lanza
  • 1,062
  • 1
  • 7
  • 24
0
votes
1 answer

Use the inout keyword when passing an NSManagedObjectContext into a function?

I'm working on my first real Core Data application and have been able to successfully pass the pointer to my managedObjectContext instance throughout my application using segues. I've run into a question however as I am at a crossroad where I need…
Dan Beaulieu
  • 17,926
  • 15
  • 92
  • 126
0
votes
1 answer

How to set a Inout parameter inside a closure

So my question is this: I'm trying to implement a extension to CLGeoCoder to be able to get a city name from a CLLocation but I'm facing a problem when I try to set the inout city name string inside the completionhandler of the…
Martin
  • 591
  • 4
  • 15
0
votes
2 answers

How to modify a two dimensional array passed to a function?

My function is as following func helper(root: TreeNode?, _ result: [[Int]], _ list: [Int], _ sum: Int, _ total: Int) { list.append(root!.val) if(total + root!.val == sum && root?.left == nil && root?.right == nil) { …
Xuting
  • 1
  • 1
-1
votes
2 answers

Inout vs pass by reference swift optimization

I have a very large list of numbers and I would like to pass it to a function to do some manipulations to it. Originally, I created a function with an inout property. As many know, inout in swift does NOT pass by reference, rather it makes an…
EK_AllDay
  • 1,033
  • 1
  • 14
  • 33
-1
votes
2 answers

inout with reg type in verilog

I have used inout with c but for c to be on the LHS of procedural assignment, it needs to be a reg type variable. Can anyone help me out with this code? module multiedgeclk(input clk ,[7:0] a,b,d, inout [7:0] c, output reg [7:0]f); always @(posedge…
Priya Mittal
  • 11
  • 1
  • 3
-1
votes
1 answer

VHDL: assigning to inout port from testbanch

I have VHDL module with bidirectional port which nested in Top module. In testbanch I try to assign data to signal which connected to bidirectional port of Top. But assigned data don't propogate to nested module bidirectional port, I see assigned…
Alex
  • 41
  • 4
-2
votes
1 answer

How to write columnwise in FORMAT in FORTRAN 77

I am using FORTRAN77 as a third party language on ANSYS computation software. Here we can write the entire row and columns to files during I/O operations. I am not able to however move the cursor to the first row and write column wise thereafter-…
Vikram
  • 1
  • 1
-4
votes
1 answer

"&" in "swap(&someInt, &anotherInt)". What does it represent? What is its function?

I'm new to Swift and I'm trying to learn the concept of 'inout' keyword. I saw this code in "the swift programming language 2.1". My question is, why is there a "&" in "swap(&someInt, &anotherInt)". What does it represent? What is its function? func…
Thor
  • 8,608
  • 10
  • 43
  • 113
1 2 3 4 5
6