Questions tagged [inline-code]

Source code that is written into the body of a program, in the same or different language as/than the host language.

196 questions
125
votes
8 answers

Are there inline functions in java?

Is there a concept of inline functions in java, or its replaced something else? If there is, how is it used? I've heard that public, static and final methods are the inline functions. Can we create our own inline function?
giri
  • 26,773
  • 63
  • 143
  • 176
73
votes
3 answers

Is it bad practice to write inline event handlers

Is it bad practice to write inline event handlers ? For me, I prefer use it when I want to use a local variable in the event handler like the following: I prefer this: // This is just a sample private void Foo() { Timer timer = new Timer() {…
Homam
  • 23,263
  • 32
  • 111
  • 187
42
votes
9 answers

onclick="" vs event handler

If I want a function to be executed, I prefer doing inline js:

Click me

because it is easier to debug. However, I hear people saying not to use inline js, and…
Johan
  • 1,537
  • 1
  • 11
  • 17
40
votes
2 answers

Inline Code in DokuWiki

I'm looking for a way to include code as part of a paragraph in DokuWiki like I can by adding backtick escapes in StackOverflow like _so_. Simply adding bla puts code on it's own line.
Alan Turing
  • 12,223
  • 16
  • 74
  • 116
21
votes
5 answers

Why there is no standard way to force inline in C++?

According to the wikipedia C++ article C++ is designed to give the programmer choice, even if this makes it possible for the programmer to choose incorrectly. If it is designed this way why there is no standard way to force the compiler to inline…
Calmarius
  • 18,570
  • 18
  • 110
  • 157
20
votes
3 answers

Can I use Extension Methods inline in an ASPX page?

Is it possible to do something like this inline in an ASPX page? <%= Me.SomeExtensionMethod() %> I can't seem to figure out how to get this to work properly. I'm receiving an error saying that "SomeExtensionMethod" is not a member of the current…
Mark Carpenter
  • 17,445
  • 22
  • 96
  • 149
18
votes
4 answers

C++'s "inline" - how strong a hint is it for GCC and Clang/LLVM?

In C++, the keyword "inline" serves two purposes. First, it allows a definition to appear in multiple translation units. Second, it's a hint to the compiler that a function should be inlined in the compiled code. My question: in code generated by…
emchristiansen
  • 3,550
  • 3
  • 26
  • 40
16
votes
3 answers

C#: Why is a function call faster than manual inlining?

I have measured the execution time for two ways of calculating the power of 2: 1) Inline result = b * b; 2) With a simple function call result = Power(b); When running in Debug mode, everything is as expected: Calling a function is considerably…
Knasterbax
  • 7,895
  • 1
  • 29
  • 23
11
votes
1 answer

Rmarkdown: writing inline dplyr code if column names have spaces defined with backticks

Problem My inline code chunk breaks when I filter() or select() a column name that has white space that I would normally define with backticks in dplyr. Example Data ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) …
sullij
  • 196
  • 8
9
votes
4 answers

Calling the original Page_Load function from inline code

I like to Monkey patch a ASPX website so that I can add stuff to the Page_Load method within a compiled assembly. My first thought was to add a script tag containing a second Page_Load method to the ASPX file like so: