Questions tagged [inout]

98 questions
0
votes
1 answer

Trying to update someone's socket programming code written in Swift 3 to Swift 5.2 (Inout expression creates a temporary pointer...)

The following code originally written in Swift 3, worked without warning in Swift 4.2, gave the warning "Inout expression creates a temporary pointer, but argument #1 should be a pointer that outlives the call to '+'" in Swift 5, now not compiling…
GOs
  • 16
  • 1
  • 5
0
votes
1 answer

Inout and NSMutableDictionary

If i run the following code in XCode 12 playground (Swift 5.3) I get the same result from two listings: import Foundation var dict = NSMutableDictionary() dict["x"] = 42 func stuff(_ d: inout NSMutableDictionary) { d["x"] =…
zaitsman
  • 8,984
  • 6
  • 47
  • 79
0
votes
2 answers

Swift - How to overload += for Int to pass the operator as a parameter in a function call like nextPage(page: pageIndex += 1)?

I would like to know how I can do the following please:- // This is not correct func += (inout lhs: Int, rhs: Int) -> Int { return lhs + rhs } Objective Usage:- scrollTo(pageIndex: pageIndex += 1)
Wael
  • 489
  • 6
  • 19
0
votes
1 answer

Swift inout passed array does not seem to effect original array

I have a simple case where I must not be using inout correctly. import Foundation func test_inout(file_data: inout Array){ let inString = "abc,def,xyz" let file_data = inString.split { $0 == ","}.map(String.init) …
George White
  • 125
  • 6
0
votes
1 answer

error "Value of type 'UIViewController' has no member..." when moving a func inside extension

I need to move a method for adding and removing a logging view inside an Extension, in order to give it to every controller. to do so I added a inout UIVew parameter to original method, where I used a global var for the view. no I have this…
biggreentree
  • 1,633
  • 3
  • 20
  • 35
0
votes
1 answer

Why does my Xcode compiler tell me I use a value type even though I use classes?

I have two classes: Player and Enemy that both conform to the protocol CharacterCharacteristicsProtocol: class Enemy: CharacterCharacteristicsProtocol {... class Player: CharacterCharacteristicsProtocol {... They are both references and not values…
Joakim Sjöstedt
  • 824
  • 2
  • 9
  • 18
0
votes
1 answer

Linking (two) bidirectional ports between (two) modules in VHDL

I have an FPGA which accepts an 8-bit address and data bus (one bus is used for both) from two microcontrollers. Using a 2:1 multiplexer, my FPGA only selects one device's inputs at a time (address and data) and the selection is based on an external…
g_ski
  • 1
0
votes
1 answer

How to guarantee that inout argument won't change Type and won't become nil in a function

Working in swift 4. I've got a function like this func setFields(_ fromView : UIView, toObject : inout T!) -> T! setFields(self.view, toObject: &self.productExtended.product) //inside ProductExtended public var product: Product When i call…
Cyber Gh
  • 180
  • 3
  • 8
0
votes
1 answer

Verilog high impedance inout synthesis

I generally don't use inout or high impedance states in verilog for synthesis (under the assumption that the internal logic ultimately has to implement it as standard CMOS 2 state logic anyways). However, I'm finding a lot of verilog that is…
serpixo
  • 310
  • 1
  • 7
0
votes
1 answer

InOut.readInt() only working in Windows Java Editor

At school, I write Java programs with Windows’ Java Editor (console mode). There, InOut.readInt() (used for user input) works without problems and I don’t have to import anything. Now, I have a Java homework for the holidays, and I try to write Java…
0
votes
2 answers

Java : Read user input via JTextField and save the input to a .txt file

I am writing a program, which represents a clock, and also has a textfield, which I instantiate with : JTextField tfield = new JTextField(); So, I want the user to fill the textfield with a String like 12 34 56 (which should set off the alarm of…
Skerre
  • 5
  • 2
0
votes
0 answers

How to use inout on array of iVars?

I'm not quite understanding why the following code does not update the original values of array1 and array2. I'm trying to use inout on an array of iVars ... import UIKit class ViewController: UIViewController { // MARK: instance variables …
Chris Allinson
  • 1,837
  • 2
  • 26
  • 39
0
votes
0 answers

VB.net SQL output loop rename file error on next loop

new to the stack here. I am developing some tools for work that allow us to pull information from a database and then operate on it with additional custom code. Since I need the output to not have a header, I want to have one file (as defined by…
DrChemE
  • 1
  • 1
0
votes
2 answers

Mux for INOUT ports

Hey guys I'm trying to exchange 2 pairs of INOUT signals, but without much sucess so far. I have two PS/2 controlers and I would like to exchange the PS2(1) to PS2(2) signals and at same time PS2(2) to PS2(1) signals. Perhaps it's simpler to explain…
DFL
  • 3
  • 3
0
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…
Priya Mittal
  • 21
  • 1
  • 2
  • 4